本文整理汇总了C++中FileIO::PushRecord方法的典型用法代码示例。如果您正苦于以下问题:C++ FileIO::PushRecord方法的具体用法?C++ FileIO::PushRecord怎么用?C++ FileIO::PushRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileIO
的用法示例。
在下文中一共展示了FileIO::PushRecord方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setInputs
/**
* liest aus der betreffenden Datei die Gewichte raus,
* falls diese nicht existiert wird eine Datei mit Startwerten erzeugt
*/
void CFunction::setInputs()
{
if(function == STEER)
{
char* dat = "steer.ai";
FileIO* fIO = new FileIO();
if(FUNCTION_NEW || !fIO->Open(dat, FILE_READ_MODE))
{
// printf("\n### make highsteer.ai\n");
fIO->Open(dat, FILE_WRITE_MODE);
fIO->PushHeader("steer");
steer[0] = 0.f;
steer[1] = 4.f;
steer[2] = 0.f;
fIO->PushRecord(steer, sizeof(float)*3);
}
else
{
//printf("\n### read highsteer.ai\n");
fIO->Open(dat, FILE_READ_MODE);
fIO->GotoHeader("steer");
fIO->PopRecord(steer);
}
//Test
/*
printf("steer[0]=%f [1]=%f [2]=%f\n",steer[0],steer[1],steer[2]);
*/
}
if(function == HIGHSTEER)
{
char* dat = "highsteer.ai";
FileIO* fIO = new FileIO();
if(FUNCTION_NEW || !fIO->Open(dat, FILE_READ_MODE))
{
// printf("\n### make highsteer.ai\n");
fIO->Open(dat, FILE_WRITE_MODE);
fIO->PushHeader("highsteerAnd11");
highsteerAnd11[0] = -1.f;
highsteerAnd11[1] = 1.f;
highsteerAnd11[2] = 1.f;
fIO->PushRecord(highsteerAnd11, sizeof(float)*3);
fIO->PushHeader("highsteerAndnot12");
highsteerAndnot12[0] = 0.f;
highsteerAndnot12[1] = 2.f;
highsteerAndnot12[2] = -1.f;
fIO->PushRecord(highsteerAndnot12, sizeof(float)*3);
fIO->PushHeader("highsteerOr21");
highsteerOr21[0] = 0.f;
highsteerOr21[1] = 3.f;
highsteerOr21[2] = 3.f;
fIO->PushRecord(highsteerOr21, sizeof(float)*3);
}
else
{
//printf("\n### read highsteer.ai\n");
fIO->Open(dat, FILE_READ_MODE);
fIO->GotoHeader("highsteerAnd11");
fIO->PopRecord(highsteerAnd11);
fIO->GotoHeader("highsteerAndnot12");
fIO->PopRecord(highsteerAndnot12);
fIO->GotoHeader("highsteerOr21");
fIO->PopRecord(highsteerOr21);
}
//Test
/*
printf("highsteerAnd[0]=%f [1]=%f [2]=%f\n",highsteerAnd11[0],highsteerAnd11[1],highsteerAnd11[2]);
printf("highsteerAndnot[0]=%f [1]=%f [2]=%f\n",highsteerAndnot12[0],highsteerAndnot12[1],highsteerAndnot12[2]);
printf("highsteerOr[0]=%f [1]=%f [2]=%f\n",highsteerOr21[0],highsteerOr21[1],highsteerOr21[2]);
*/
}
if(function == SPEED)
{
char* dat = "speed.ai";
FileIO* fIO = new FileIO();
if(FUNCTION_NEW || !fIO->Open(dat, FILE_READ_MODE))
{
//printf("\n### make speed.ai\n");
fIO->Open(dat, FILE_WRITE_MODE);
fIO->PushHeader("speedAnd11");
speedAnd11[0] = -50.f;
speedAnd11[1] = 10.f;
speedAnd11[2] = 1.f;
fIO->PushRecord(speedAnd11, sizeof(float)*3);
fIO->PushHeader("speedAndnot12");
//.........这里部分代码省略.........