本文整理汇总了C++中FilePtr::readLine方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePtr::readLine方法的具体用法?C++ FilePtr::readLine怎么用?C++ FilePtr::readLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePtr
的用法示例。
在下文中一共展示了FilePtr::readLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadMessageInfo
//------------------------------------------------------------------------------------------
long Radio::loadMessageInfo(void)
{
FullPathFileName messageInfoPath;
FilePtr messageInfoFile;
long result;
char dataLine[512];
char* field;
messageInfoPath.init(soundPath,"radio",".csv");
messageInfoFile = new File;
if (!messageInfoFile)
return -1; //quasit
result = messageInfoFile->open(messageInfoPath);
if (result != NO_ERR)
{
delete messageInfoFile;
return result;
}
messageInfoFile->readLine((MemoryPtr)dataLine, 511); // skip title line
for (long i=0; i<RADIO_MESSAGE_COUNT; i++)
{
result = messageInfoFile->readLine((MemoryPtr)dataLine, 511);
if (!result)
Fatal(0, "Bad Message Info File");
field = strtok(dataLine, ","); // get past command name
field = strtok(NULL, ",");
if (field)
messageInfo[i].priority = atoi(field);
else
messageInfo[i].priority = 4;
field = strtok(NULL, ",");
if (field)
messageInfo[i].shelfLife = atoi(field);
else
messageInfo[i].shelfLife = 0;
field = strtok(NULL, ",");
if (field && *field != 'x')
messageInfo[i].movieCode = *field;
else
messageInfo[i].movieCode = '\0';
field = strtok(NULL, ",");
if (field)
messageInfo[i].styleCount = atoi(field);
else
messageInfo[i].styleCount = 1;
field = strtok(NULL, ",");
if (field)
messageInfo[i].styleChance[0] = atoi(field);
else
messageInfo[i].styleChance[0] = 0;
field = strtok(NULL, ",");
if (field)
messageInfo[i].styleChance[1] = atoi(field);
else
messageInfo[i].styleChance[1] = 0;
field = strtok(NULL, ",");
if (field)
messageInfo[i].styleChance[2] = atoi(field);
else
messageInfo[i].styleChance[2] = 0;
field = strtok(NULL, ",");
if (field)
messageInfo[i].pilotIdentifiesSelf = (*field == 'y');
else
messageInfo[i].pilotIdentifiesSelf = FALSE;
field = strtok(NULL, ",");
if (field)
messageInfo[i].messageMapping = atoi(field);
else
messageInfo[i].messageMapping = 0;
field = strtok(NULL, ",");
if (field)
{
field = strtok(NULL, ",");
if (field)
{
messageInfo[i].kludgeStyle = (*field == 'x');
}
}
if (!field)
messageInfo[i].kludgeStyle = FALSE;
}
messageInfoFile->close();
delete messageInfoFile;
return NO_ERR;
}