• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ core_fclose函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中core_fclose函数的典型用法代码示例。如果您正苦于以下问题:C++ core_fclose函数的具体用法?C++ core_fclose怎么用?C++ core_fclose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了core_fclose函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: core_fload

file_error core_fload(const char *filename, dynamic_buffer &data)
{
	core_file *file = NULL;
	file_error err;
	UINT64 size;

	/* attempt to open the file */
	err = core_fopen(filename, OPEN_FLAG_READ, &file);
	if (err != FILERR_NONE)
		return err;

	/* get the size */
	size = core_fsize(file);
	if ((UINT32)size != size)
	{
		core_fclose(file);
		return FILERR_OUT_OF_MEMORY;
	}

	/* allocate memory */
	data.resize(size);

	/* read the data */
	if (core_fread(file, &data[0], size) != size)
	{
		core_fclose(file);
		data.clear();
		return FILERR_FAILURE;
	}

	/* close the file and return data */
	core_fclose(file);
	return FILERR_NONE;
}
开发者ID:BrandoCommando,项目名称:mame,代码行数:34,代码来源:corefile.c


示例2: core_fclose

void device_image_interface::clear()
{
	if (m_mame_file)
	{
		m_mame_file = nullptr;
		m_file = nullptr;
	} else {
		if (m_file)
		{
			core_fclose(m_file);
			m_file = nullptr;
		}
	}

	m_image_name.clear();
	m_readonly = false;
	m_created = false;

	m_longname.clear();
	m_manufacturer.clear();
	m_year.clear();
	m_basename.clear();
	m_basename_noext.clear();
	m_filetype.clear();

	m_full_software_name.clear();
	m_software_info_ptr = nullptr;
	m_software_part_ptr = nullptr;
	m_software_list_name.clear();
}
开发者ID:DragonMinded,项目名称:mame,代码行数:30,代码来源:diimage.cpp


示例3: _7z_file_close

void emu_file::close()
{
	// close files and free memory
	if (m__7zfile != nullptr)
		_7z_file_close(m__7zfile);
	m__7zfile = nullptr;

	if (m_zipfile != nullptr)
		zip_file_close(m_zipfile);
	m_zipfile = nullptr;

	if (m_file != nullptr)
		core_fclose(m_file);
	m_file = nullptr;

	m__7zdata.clear();
	m_zipdata.clear();

	if (m_remove_on_close)
		osd_rmfile(m_fullpath.c_str());
	m_remove_on_close = false;

	// reset our hashes and path as well
	m_hashes.reset();
	m_fullpath.clear();
}
开发者ID:ursine,项目名称:mame,代码行数:26,代码来源:fileio.cpp


示例4: output_footer_and_close_file

static void output_footer_and_close_file(core_file *file, std::string &templatefile, std::string &title)
{
	std::string modified(templatefile);
	strreplace(modified, "<!--TITLE-->", title.c_str());
	core_fwrite(file, modified.c_str(), modified.length());
	core_fclose(file);
}
开发者ID:ccmurray,项目名称:mame,代码行数:7,代码来源:regrep.cpp


示例5: output_footer_and_close_file

static void output_footer_and_close_file(core_file *file, astring &templatefile, astring &path)
{
	astring modified(templatefile);
	modified.replace(0, "<!--PATH-->", path.cstr());
	core_fwrite(file, modified.cstr(), modified.len());
	core_fclose(file);
}
开发者ID:CJBass,项目名称:mame2013-libretro,代码行数:7,代码来源:src2html.c


示例6: stream_close

void stream_close(imgtool_stream *s)
{
    assert(s != NULL);

    switch(s->imgtype)
    {
    case IMG_FILE:
        if (s->u.file != NULL)
        {
            core_fclose(s->u.file);
            s->u.file = NULL;
        }
        break;

    case IMG_MEM:
        if (s->u.buffer != NULL)
        {
            free(s->u.buffer);
            s->u.buffer = NULL;
        }
        break;

    default:
        assert(0);
        break;
    }
    free((void *) s);
}
开发者ID:cdenix,项目名称:psmame,代码行数:28,代码来源:stream.c


示例7: zippath_fopen

floppy_image_format_t *floppy_image_device::identify(std::string filename)
{
	core_file *fd;
	std::string revised_path;

	file_error err = zippath_fopen(filename.c_str(), OPEN_FLAG_READ, fd, revised_path);
	if(err) {
		seterror(IMAGE_ERROR_INVALIDIMAGE, "Unable to open the image file");
		return 0;
	}

	io_generic io;
	io.file = fd;
	io.procs = &corefile_ioprocs_noclose;
	io.filler = 0xff;
	int best = 0;
	floppy_image_format_t *best_format = 0;
	for(floppy_image_format_t *format = fif_list; format; format = format->next) {
		int score = format->identify(&io, form_factor);
		if(score > best) {
			best = score;
			best_format = format;
		}
	}
	core_fclose(fd);
	return best_format;
}
开发者ID:ValleyBell,项目名称:mame,代码行数:27,代码来源:floppy.c


示例8: output_footer_and_close_file

static void output_footer_and_close_file(core_file *file, astring &templatefile, astring &title)
{
	astring modified(templatefile);
	modified.replace(0, "<!--TITLE-->", title.c_str());
	core_fwrite(file, modified.c_str(), modified.len());
	core_fclose(file);
}
开发者ID:relimited,项目名称:mame,代码行数:7,代码来源:regrep.c


示例9: global_free

void device_image_interface::clear()
{
	if (m_mame_file)
    {
		global_free(m_mame_file);
		m_mame_file = NULL;
		m_file = NULL;
	} else {
		if (m_file)
		{
			core_fclose(m_file);
			m_file = NULL;
		}
	}

    m_image_name.reset();
    m_readonly = false;
    m_created = false;

    m_longname.reset();
    m_manufacturer.reset();
    m_year.reset();
	m_basename.reset();
    m_basename_noext.reset();
	m_filetype.reset();

	m_full_software_name = NULL;
	m_software_info_ptr = NULL;
	m_software_part_ptr = NULL;
	m_software_list_name = NULL;
}
开发者ID:NastyNoah,项目名称:groovyarcade.groovymame,代码行数:31,代码来源:diimage.c


示例10: mame_fclose

void legacy_image_device_base::clear()
{
	if (m_mame_file)
    {
		mame_fclose(m_mame_file);
		m_mame_file = NULL;
		m_file = NULL;
	} else {
		if (m_file)
		{
			core_fclose(m_file);
			m_file = NULL;
		}
	}

    m_name.reset();
    m_writeable = FALSE;
    m_created = FALSE;

    m_longname.reset();
    m_manufacturer.reset();
    m_year.reset();
    m_playable.reset();
    m_extrainfo.reset();
    m_basename_noext.reset();
	m_filetype.reset();

	m_full_software_name = NULL;
	m_software_info_ptr = NULL;
	m_software_part_ptr = NULL;
}
开发者ID:libretro,项目名称:mame2010-libretro,代码行数:31,代码来源:devimage.c


示例11: _7z_file_close

void emu_file::close()
{
    // close files and free memory
    if (m__7zfile != NULL)
        _7z_file_close(m__7zfile);
    m__7zfile = NULL;

    if (m_zipfile != NULL)
        zip_file_close(m_zipfile);
    m_zipfile = NULL;

    if (m_file != NULL)
        core_fclose(m_file);
    m_file = NULL;

    m__7zdata.reset();
    m_zipdata.reset();

    if (m_remove_on_close)
        osd_rmfile(m_fullpath);
    m_remove_on_close = false;

    // reset our hashes and path as well
    m_hashes.reset();
    m_fullpath.reset();
}
开发者ID:Gu1,项目名称:libretro-mame,代码行数:26,代码来源:fileio.c


示例12: astring_dup

static astring *find_include_file(int srcrootlen, const astring *srcfile, const astring *filename)
{
	include_path *curpath;

	/* iterate over include paths and find the file */
	for (curpath = incpaths; curpath != NULL; curpath = curpath->next)
	{
		astring *srcincpath = astring_dup(curpath->path);
		core_file *testfile;
		int lastsepindex = 0;
		int sepindex;

		/* a '.' include path is specially treated */
		if (astring_cmpc(curpath->path, ".") == 0)
			astring_cpysubstr(srcincpath, srcfile, 0, astring_rchr(srcfile, 0, PATH_SEPARATOR[0]));

		/* append the filename piecemeal to account for directories */
		while ((sepindex = astring_chr(filename, lastsepindex, '/')) != -1)
		{
			astring *pathpart = astring_dupsubstr(filename, lastsepindex, sepindex - lastsepindex);

			/* handle .. by removing a chunk from the incpath */
			if (astring_cmpc(pathpart, "..") == 0)
			{
				int sepindex_part = astring_rchr(srcincpath, 0, PATH_SEPARATOR[0]);
				if (sepindex_part != -1)
					astring_substr(srcincpath, 0, sepindex_part);
			}

			/* otherwise, append a path separator and the pathpart */
			else
				astring_cat(astring_catc(srcincpath, PATH_SEPARATOR), pathpart);

			/* advance past the previous index */
			lastsepindex = sepindex + 1;

			/* free the path part we extracted */
			astring_free(pathpart);
		}

		/* now append the filename */
		astring_catsubstr(astring_catc(srcincpath, PATH_SEPARATOR), filename, lastsepindex, -1);

		/* see if we can open it */
		if (core_fopen(astring_c(srcincpath), OPEN_FLAG_READ, &testfile) == FILERR_NONE)
		{
			/* close the file */
			core_fclose(testfile);
			return srcincpath;
		}

		/* free our include path */
		astring_free(srcincpath);
	}
	return NULL;
}
开发者ID:Luke-Nukem,项目名称:mame-144-vector_mod,代码行数:56,代码来源:makedep.c


示例13: output_footer_and_close_file

static void output_footer_and_close_file(core_file *file, const astring *templatefile, const astring *title)
{
	astring *modified;

	modified = astring_dup(templatefile);
	astring_replacec(modified, 0, "<!--TITLE-->", astring_c(title));
	core_fwrite(file, astring_c(modified), astring_len(modified));
	astring_free(modified);
	core_fclose(file);
}
开发者ID:DarrenBranford,项目名称:MAME4iOS,代码行数:10,代码来源:regrep.c


示例14: check_file

static bool check_file(astring &srcincpath)
{
	// see if we can open it
	core_file *testfile;
	if (core_fopen(srcincpath, OPEN_FLAG_READ, &testfile) == FILERR_NONE)
	{
		// close the file
		core_fclose(testfile);
		return true;
	}
	return false;
}
开发者ID:dezi,项目名称:mame-libretro-odroid,代码行数:12,代码来源:makemak.c


示例15: core_fclose

int device_image_interface::reopen_for_write(const char *path)
{
	if(m_file)
		core_fclose(m_file);

    file_error filerr = FILERR_NOT_FOUND;
    image_error_t err = IMAGE_ERROR_FILENOTFOUND;
    astring revised_path;

    /* attempt to open the file for writing*/
    filerr = zippath_fopen(path, OPEN_FLAG_READ|OPEN_FLAG_WRITE|OPEN_FLAG_CREATE, m_file, revised_path);

    /* did the open succeed? */
    switch(filerr)
    {
        case FILERR_NONE:
            /* success! */
            m_readonly = 0;
            m_created = 1;
            err = IMAGE_ERROR_SUCCESS;
            break;

        case FILERR_NOT_FOUND:
        case FILERR_ACCESS_DENIED:
            /* file not found (or otherwise cannot open); continue */
            err = IMAGE_ERROR_FILENOTFOUND;
            break;

        case FILERR_OUT_OF_MEMORY:
            /* out of memory */
            err = IMAGE_ERROR_OUTOFMEMORY;
            break;

        case FILERR_ALREADY_OPEN:
            /* this shouldn't happen */
            err = IMAGE_ERROR_ALREADYOPEN;
            break;

        case FILERR_FAILURE:
        case FILERR_TOO_MANY_FILES:
        case FILERR_INVALID_DATA:
        default:
            /* other errors */
            err = IMAGE_ERROR_INTERNAL;
            break;
    }

    /* if successful, set the file name */
    if (filerr == FILERR_NONE)
        set_image_filename(revised_path);

    return err;
}
开发者ID:NastyNoah,项目名称:groovyarcade.groovymame,代码行数:53,代码来源:diimage.c


示例16: main

int main(int argc, char *argv[])
{
	// validate arguments
	if (argc < 3)
	{
		fprintf(stderr, "Usage:\n%s <input.png> [<input2.png> [...]] <output.bdc>\n", argv[0]);
		return 1;
	}
	const char *bdcname = argv[argc - 1];

	// iterate over input files
	static render_font font;
	bool error = false;
	// create font temporary file
	error = render_font_create_temporaryfile(font, bdcname);
	for (int curarg = 1; curarg < argc - 1; curarg++)
	{
		// load the png file
		const char *pngname = argv[curarg];
		core_file *file;
		file_error filerr = core_fopen(pngname, OPEN_FLAG_READ, &file);
		if (filerr != FILERR_NONE)
		{
			fprintf(stderr, "Error %d attempting to open PNG file\n", filerr);
			error = true;
			break;
		}

		bitmap_argb32 bitmap;
		png_error pngerr = png_read_bitmap(file, bitmap);
		core_fclose(file);
		if (pngerr != PNGERR_NONE)
		{
			fprintf(stderr, "Error %d reading PNG file\n", pngerr);
			error = true;
			break;
		}

		// parse the PNG into characters
		error = bitmap_to_chars(bitmap, font);
		if (error)
			break;

		// write out the resulting font
		error = render_font_save_cached(font, bdcname, 0);
		if (error)
			break;
	}

	// cleanup after ourselves
	return error ? 1 : 0;
}
开发者ID:crazii,项目名称:mameplus,代码行数:52,代码来源:png2bdc.c


示例17: output_footer_and_close_file

static void output_footer_and_close_file(core_file *file)
{
	core_fprintf(file,
		"\n"
		"\t</div>\n"
		"\t</div>\n"
		"\t</div>\n"
		"</body>"
		"\n"
		"</html>\n"
	);
	core_fclose(file);
}
开发者ID:cdenix,项目名称:ps3-mame-0125,代码行数:13,代码来源:src2html.c


示例18: render_font_create_temporaryfile

static bool render_font_create_temporaryfile(render_font &font, const char *filename)
{
	total_numchars = 0;
	m_chartable.clear();

	core_file *file;
	astring tmp_filename(filename, ".tmp");
	file_error filerr = core_fopen(tmp_filename.cstr(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file);
	if (filerr != FILERR_NONE)
		return true;
	core_fclose(file);

	return false;
}
开发者ID:crazii,项目名称:mameplus,代码行数:14,代码来源:png2bdc.c


示例19: core_fload

file_error core_fload(const char *filename, void **data, UINT32 *length)
{
	core_file *file = NULL;
	file_error err;
	UINT64 size;

	/* attempt to open the file */
	err = core_fopen(filename, OPEN_FLAG_READ, &file);
	if (err != FILERR_NONE)
		return err;

	/* get the size */
	size = core_fsize(file);
	if ((UINT32)size != size)
	{
		core_fclose(file);
		return FILERR_OUT_OF_MEMORY;
	}

	/* allocate memory */
	*data = osd_malloc(size);
	if (length != NULL)
		*length = (UINT32)size;

	/* read the data */
	if (core_fread(file, *data, size) != size)
	{
		core_fclose(file);
		free(*data);
		return FILERR_FAILURE;
	}

	/* close the file and return data */
	core_fclose(file);
	return FILERR_NONE;
}
开发者ID:LibXenonProject,项目名称:mame-lx,代码行数:36,代码来源:corefile.c


示例20: find_include_file

static bool find_include_file(astring &srcincpath, int srcrootlen, const astring &srcfile, const astring &filename)
{
	// iterate over include paths and find the file
	for (include_path *curpath = incpaths; curpath != NULL; curpath = curpath->next)
	{
		// a '.' include path is specially treated
		if (curpath->path == ".")
			srcincpath.cpysubstr(srcfile, 0, srcfile.rchr(0, PATH_SEPARATOR[0]));
		else
			srcincpath.cpy(curpath->path);

		// append the filename piecemeal to account for directories
		int lastsepindex = 0;
		int sepindex;
		while ((sepindex = filename.chr(lastsepindex, '/')) != -1)
		{
			astring pathpart(filename, lastsepindex, sepindex - lastsepindex);

			// handle .. by removing a chunk from the incpath
			if (pathpart == "..")
			{
				int sepindex_part = srcincpath.rchr(0, PATH_SEPARATOR[0]);
				if (sepindex_part != -1)
					srcincpath.substr(0, sepindex_part);
			}

			// otherwise, append a path separator and the pathpart
			else
				srcincpath.cat(PATH_SEPARATOR).cat(pathpart);

			// advance past the previous index
			lastsepindex = sepindex + 1;
		}

		// now append the filename
		srcincpath.cat(PATH_SEPARATOR).catsubstr(filename, lastsepindex, -1);

		// see if we can open it
		core_file *testfile;
		if (core_fopen(srcincpath, OPEN_FLAG_READ, &testfile) == FILERR_NONE)
		{
			// close the file
			core_fclose(testfile);
			return true;
		}
	}
	return false;
}
开发者ID:Ced2911,项目名称:drunken-ironman,代码行数:48,代码来源:makedep.c



注:本文中的core_fclose函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ core_fsize函数代码示例发布时间:2022-05-30
下一篇:
C++ copystring函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap