当前位置: 首页>>代码示例>>C++>>正文


C++ FileFormat::openFile方法代码示例

本文整理汇总了C++中FileFormat::openFile方法的典型用法代码示例。如果您正苦于以下问题:C++ FileFormat::openFile方法的具体用法?C++ FileFormat::openFile怎么用?C++ FileFormat::openFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileFormat的用法示例。


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

示例1: Load

McoStatus PrinterType::Load(FSSpec *fspec)
{
int i;
McoStatus status = MCO_SUCCESS;
FileFormat *filef;
int   magic_num;
int   version;


filef = new FileFormat;

status = filef->openFile(fspec);
if (status != MCO_SUCCESS) goto bail;

status = filef->relRead(sizeof(int),(char*)&magic_num);
if (status != MCO_SUCCESS) goto bailclose;

status = filef->relRead(sizeof(int),(char*)&version);
if (status != MCO_SUCCESS) goto bailclose;
if (version != PRINTERTYPE_VERSION) goto bailclose;

status = filef->relRead(sizeof(ConData),(char*)&data);
if (status != MCO_SUCCESS) goto bailclose;

status = filef->relRead(sizeof(int),(char*)&num_hands);
if (status != MCO_SUCCESS) goto bailclose;

status = filef->relRead(sizeof(double)*31,(char*)x_hands);
if (status != MCO_SUCCESS) goto bailclose;

status = filef->relRead(sizeof(double)*31,(char*)y_hands);
if (status != MCO_SUCCESS) goto bailclose;

status = filef->relRead(sizeof(int),(char*)&sim_num);
if (status != MCO_SUCCESS) goto bailclose;

status = filef->relRead(sizeof(int),(char*)&num_tweaks);
if (status != MCO_SUCCESS) goto bailclose;

for (i=0; i<num_tweaks; i++)
	{
	if (!tweaks[i]) 
	tweaks[i] = new Tweak_Element(0L);
	if (!tweaks[i]) goto bailclose;
	status = filef->relRead(sizeof(Tweak_Element),(char*)tweaks[i]);
	if (status != MCO_SUCCESS) goto bailclose;
	}
	


bailclose:
filef->closeFile();
bail:
delete filef;
return status;
}
开发者ID:,项目名称:,代码行数:56,代码来源:

示例2: Save

McoStatus PrinterType::Save(FSSpec *fspec)
{
	int i;
	McoStatus status = MCO_SUCCESS;
	FileFormat *filef;
	int   magic_num = PRINTERTYPE_MAGICNUM;
	int   version = PRINTERTYPE_VERSION;
	
	filef = new FileFormat;

//	status = filef->createFilewithtype(fspec,smSystemScript,'Mprn','MCO6');
//	if (status != MCO_SUCCESS) goto bail;

	status = filef->openFile(fspec);
	if (status != MCO_SUCCESS) goto bail;

	status = filef->relWrite(sizeof(int),(char*)&magic_num);
	if (status != MCO_SUCCESS) goto bailclose;

	status = filef->relWrite(sizeof(int),(char*)&version);
	if (status != MCO_SUCCESS) goto bailclose;

	status = filef->relWrite(sizeof(ConData),(char*)&data);
	if (status != MCO_SUCCESS) goto bailclose;

	status = filef->relWrite(sizeof(int),(char*)&num_hands);
	if (status != MCO_SUCCESS) goto bailclose;

	status = filef->relWrite(sizeof(double)*31,(char*)x_hands);
	if (status != MCO_SUCCESS) goto bailclose;

	status = filef->relWrite(sizeof(double)*31,(char*)y_hands);
	if (status != MCO_SUCCESS) goto bailclose;
	
	status = filef->relWrite(sizeof(int),(char*)&sim_num);
	if (status != MCO_SUCCESS) goto bailclose;

	status = filef->relWrite(sizeof(int),(char*)&num_tweaks);
	if (status != MCO_SUCCESS) goto bailclose;

	for (i=0; i<num_tweaks; i++)
		{
		status = filef->relWrite(sizeof(Tweak_Element),(char*)tweaks[i]);
		if (status != MCO_SUCCESS) goto bailclose;
		}

	filef->setInfo(fspec,MONACO_SIG,'MCO6');

	bailclose:
	filef->closeFile();
	bail:
	delete filef;
	return status;
}
开发者ID:,项目名称:,代码行数:54,代码来源:

示例3:

Defaults::~Defaults(void)
{
FileFormat *filef;
FSSpec fspec;
McoStatus status;
int		magic_num = DEFAULTS_MAGIC_NUM;
int		version = DEFAULTS_VERSION;
Str255  def = MONACO_DEFAULT;
Str255  fold = MONACO_FOLDER;

// now try to load in the user defults
filef = new FileFormat;

ptocstr(def);
ptocstr(fold);

status = filef->createFileinPref(&fspec,(char*)def,(char*)fold);
if (status != MCO_SUCCESS) return;

status = filef->openFile(&fspec);
if (status != MCO_SUCCESS) return;

status = filef->relWrite(sizeof(int),(char*)&magic_num);
if (status != MCO_SUCCESS) return;

status = filef->relWrite(sizeof(int),(char*)&version);
if (status != MCO_SUCCESS) return;

status = filef->relWrite(sizeof(int),(char*)&printer_type);
if (status != MCO_SUCCESS) return;

status = filef->relWrite(sizeof(int),(char*)&input_type);
if (status != MCO_SUCCESS) return;

status = filef->relWrite(sizeof(int),(char*)&patch_format);
if (status != MCO_SUCCESS) return;

status = filef->relWrite(sizeof(int),(char*)&port);
if (status != MCO_SUCCESS) return;

filef->setInfo(&fspec,MONACO_SIG,'MCO7');

filef->closeFile();
delete filef;
}
开发者ID:,项目名称:,代码行数:45,代码来源:


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