本文整理汇总了C++中TextFile::write方法的典型用法代码示例。如果您正苦于以下问题:C++ TextFile::write方法的具体用法?C++ TextFile::write怎么用?C++ TextFile::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextFile
的用法示例。
在下文中一共展示了TextFile::write方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: save
void SynonymMap::save(const string& sFileName)
{
TextFile tf;
tf.open(sFileName.c_str(), "w");
for(SynMap::const_iterator it = m_synMap.begin(); it != m_synMap.end();it++)
{
tf.write(it->first.c_str());
Group* pGroup = it->second;
tf.write(":");
for(Group::const_iterator git = pGroup->begin(); git != pGroup->end(); git++)
{
tf.write((*git).c_str());
if( (git + 1) != pGroup->end())
{
tf.write(",");
}
}
tf.write("\n");
}
tf.close();
}
示例2:
void operator << ( TextFile & file, stringstream & strm )
{
// get buffer
string & str = strm.str();
char * buffer = (char *) str.c_str();
if ( !buffer )
return;
// write buffer to file
long sz = str.size();
file.write(buffer,sz);
}
示例3: writeNocashSym
void SymbolData::writeNocashSym()
{
if (nocashSymFileName.empty())
return;
std::vector<NocashSymEntry> entries;
for (size_t k = 0; k < modules.size(); k++)
{
SymDataModule& module = modules[k];
for (size_t i = 0; i < module.symbols.size(); i++)
{
SymDataSymbol& sym = module.symbols[i];
NocashSymEntry entry;
entry.address = sym.address;
entry.text = sym.name;
entries.push_back(entry);
}
for (size_t i = 0; i < module.data.size(); i++)
{
SymDataData& data = module.data[i];
NocashSymEntry entry;
entry.address = data.address;
switch (data.type)
{
case Data8:
entry.text = formatString(".byt:%04X",data.size);
break;
case Data16:
entry.text = formatString(".wrd:%04X",data.size);
break;
case Data32:
entry.text = formatString(".dbl:%04X",data.size);
break;
case DataAscii:
entry.text = formatString(".asc:%04X",data.size);
break;
}
entries.push_back(entry);
}
}
std::sort(entries.begin(),entries.end());
TextFile file;
if (file.open(nocashSymFileName,TextFile::Write,TextFile::ASCII) == false)
{
Logger::printError(Logger::Error,L"Could not open sym file %s.",file.getFileName().c_str());
return;
}
file.writeLine(L"00000000 0");
for (size_t i = 0; i < entries.size(); i++)
{
file.writeFormat(L"%08X %S\n",entries[i].address,entries[i].text.c_str());
}
file.write("\x1A");
file.close();
}