本文整理汇总了C++中Input::ReadInputFile方法的典型用法代码示例。如果您正苦于以下问题:C++ Input::ReadInputFile方法的具体用法?C++ Input::ReadInputFile怎么用?C++ Input::ReadInputFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::ReadInputFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
if(argc < 2)
return -1;
string theOutput = "cl ";
string currentArg;
ReturnItem mapping;
Input theInput;
CommandLine theCommandLine;
#ifndef CCMEMORY // if we compile to read from memory or to read from a file
if(theInput.ReadInputFile("ccFile.cfg") == -1) // the file name is fixed
return -1;
#else
theInput.CreatePairsFromCode();
#endif
// here we read in the command line
theCommandLine.ReadCommandLine(argc - 1, &argv[1]);
// iterate over each word in the command line
while("" != (currentArg = theCommandLine.GetNextWord()))
{
// find the best mapping for each word
mapping = theInput.BestMapping(currentArg);
// create the output string
if(mapping.error == FATAL)
{
cerr << "Error with flag " << mapping.bestMap << " -- ABORTING\n";
return -1;
}
if(mapping.error == WARNING)
{
cerr << "Warning: Flag may not be properly supported: " << mapping.bestMap << endl;
}
theOutput += mapping.bestMap + mapping.remainingString;
if(mapping.space)
theOutput += " ";
}
cout << theOutput << endl;
// execute the generated output string. 'cl.exe' will need to be in the users path
system(theOutput.c_str());
return 0;
}