示例#1
0
文件: nGDFile.c 项目: TheHippo/hxGD
value ImageCreateFromGif(value filename) {
	FILE *_file = openFileRead(filename);
	gdImagePtr img = gdImageCreateFromGif(_file);
	fclose(_file);
	if (img == NULL) failure("image file could not be loaded: probably wrong format");
	return alloc_gc_image(img);
}
示例#2
0
文件: nGDFile.c 项目: TheHippo/hxGD
value ImageCreateFromGd2Part(value filename, value srcX, value srcY, value width, value height) {
	FILE *_file = openFileRead(filename);
	int _srcX = val_int(srcX);
	int _srcY = val_int(srcY);
	int _width = val_int(width);
	int _height = val_int(height);
	gdImagePtr img = gdImageCreateFromGd2Part(_file,_srcX,_srcY,_width,_height);
	fclose(_file);
	return alloc_gc_image(img);
}
示例#3
0
    std::string FileSystem::readFileAsString(const std::string &fileName) {
        std::stringstream result;

        if(exists(fileName)) {
            auto fs = openFileRead(fileName);

            result << fs->rdbuf();
        }

        return result.str();
    }
示例#4
0
    std::vector<char> FileSystem::readFileAsCharBuffer(const std::string & fileName) {
        std::vector<char> buffer;

        if(exists(fileName)) {
            int length = 0;
            auto fs = openFileRead(fileName);

            fs->seekg (0, std::ios::end);
            length = static_cast<int>(fs->tellg());
            fs->seekg (0, std::ios::beg);

            buffer.reserve(length);

            fs->read(&buffer[0], length);
        }

        return buffer;
    }
示例#5
0
int openStudentFile(FILE **fileRead, FILE **fileWrite)
{
	if (openFileRead("data.txt", fileRead) == -1)
	{
		// if open file has error, then create the file
		if (openFileWrite("data.txt", fileWrite) == -1)
		{
			printf("Cannot create data.txt! Serious error! \n");
			return -1;
		}
		else
		{
			printf("Created empty data.txt, because file did not exist\n");
			fprintf(*fileWrite, "%s\t%s\t%s\t%s\t\n", "회원ID", "회원이름", "회원주소", "핸드폰번호");
			fflush(*fileWrite);

			return 1;
		}
	}

	return 0;
}
示例#6
0
文件: nGDFile.c 项目: TheHippo/hxGD
value ImageCreateFromWBMP(value filename) {
	FILE *_file = openFileRead(filename);
	gdImagePtr img = gdImageCreateFromWBMP(_file);
	fclose(_file);
	return alloc_gc_image(img);
}