本文整理汇总了C++中TdfParser::LoadBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ TdfParser::LoadBuffer方法的具体用法?C++ TdfParser::LoadBuffer怎么用?C++ TdfParser::LoadBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TdfParser
的用法示例。
在下文中一共展示了TdfParser::LoadBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Open
void Log::Open(){
//char buffer[1000];
if( Lmagic != 95768){
Lmagic = 95768;
First = true;
}
time_t now1;
time(&now1);
struct tm *now2;
now2 = localtime(&now1);
std::string filename = G->info->datapath + slash + "Logs" + slash;
// DDD MMM DD HH:MM:SS YYYY_X - NTAI.log
filename += to_string(now2->tm_mon+1)+"-" +to_string(now2->tm_mday) + "-" +to_string(now2->tm_year + 1900) +"-" +to_string(now2->tm_hour) +"_" +to_string(now2->tm_min) +"["+to_string(G->Cached->team)+"]XE10.1.log";
logFile.open(filename.c_str());
if(logFile.is_open() == false){
logFile.close();
logFile.open(filename.c_str());
if(logFile.is_open() == false){
iprint(std::string("Error!!! ") + filename + std::string(" refused to open!"));
verbose = true;
return;
}
}
header(" :: NTAI XE10.1 Log File \n :: Programmed and maintained by AF/T.Nowell \n :: Copyright (C) 2004 Tom Nowell/AF \n");
logFile << " :: Game started: " << now2->tm_mday << "." << now2->tm_mon << "." << 1900 + now2->tm_year << " " << now2->tm_hour << ":" << now2->tm_min << ":" << now2->tm_sec << std::endl << std::endl << std::flush;
int size = G->cb->GetFileSize("modinfo.tdf");
char* c = new char[size];
if(size > 0){
G->cb->ReadFile(filename.c_str(),c,size);
TdfParser cp;
cp.LoadBuffer(c,(std::size_t)size);
std::string tempstr = "";
cp.SGetValue(tempstr, "MOD\\Name");
logFile << " :: " << tempstr << std::endl << std::flush;
tempstr = "";
cp.SGetValue(tempstr, "MOD\\Description");
logFile << " :: " << tempstr << std::endl << std::flush;
}
if(First == true) logFile << " :: First instance of NTAI" << std::endl;
logFile << std::endl << std::flush;
}