本文整理汇总了C++中TextFile::readString方法的典型用法代码示例。如果您正苦于以下问题:C++ TextFile::readString方法的具体用法?C++ TextFile::readString怎么用?C++ TextFile::readString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextFile
的用法示例。
在下文中一共展示了TextFile::readString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse
/**
* Parses specified string.
* Sets error if parsed string doesnt match.
*/
void parse(const char* str)
{
char buf[256];
m_file.readString(buf, sizeof(buf));
if(strcmp(str, buf))
{
m_err = MapFile::ERROR_PARSE;
m_errLine = m_file.line();
}
}
示例2: parseSegments
/**
* Example:
* (Start) Length Name Class
* 0001:00000000 00002c05H .text CODE
*/
void parseSegments()
{
parse("Length");
parse("Name");
parse("Class");
m_file.skipWhitespace();
while(!error())
{
int seg = m_file.readHex();
parse(':');
int offs = m_file.readHex();
int len = m_file.readHex();
parse('H');
char buf[256];
m_file.readString(buf, sizeof(buf));
segments.add(MapFileEntry(seg, offs, len, buf));
// break at empty line
if(nextLineEmpty())
break;
}
}
示例3: parseEntries
/**
* Example:
* (Address) Publics by Value Rva+Base Lib:Object
* 0001:000001a0 [email protected]@YAXXZ 004011a0 f main.obj
*/
void parseEntries()
{
parse("Publics");
parse("by");
parse("Value");
parse("Rva+Base");
parse("Lib:Object");
m_file.skipWhitespace();
while(!error())
{
int seg = m_file.readHex();
parse(':');
int offs = m_file.readHex();
char buf[256];
m_file.readString(buf, sizeof(buf));
char* entryname = buf;
// chop entry name at @@
char* end = strstr(entryname, "@@");
if(end)
*end = 0;
// skip preceding ?01..
while(isdigit(*entryname) || *entryname == '?' || *entryname == '$')
++entryname;
// conv @ -> .
for(char* str = entryname ; *str ; ++str)
if(*str == '@')
*str = '.';
entries.add(MapFileEntry(seg, offs, 0, entryname));
// break at empty line
if(nextLineEmpty())
break;
}
}