本文整理汇总了C++中util::fileExists方法的典型用法代码示例。如果您正苦于以下问题:C++ util::fileExists方法的具体用法?C++ util::fileExists怎么用?C++ util::fileExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util
的用法示例。
在下文中一共展示了util::fileExists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initStreams
void initStreams()
{
string parametersPassiveFileName("../OpenGL/parametersPassiveCdef.txt");
inputParameters.open(parametersPassiveFileName);
if ( !inputParameters.good() )
{
cerr << "File " << parametersPassiveFileName << " doesn't exist, enter a valid path" << endl;
cin.ignore(1E6,'\n');
exit(0);
}
parameters.loadParameterFile(inputParameters);
#ifdef _WIN32
// WARNING:
// Base directory and subject name, if are not
// present in the parameters file, the program will stop suddenly!!!
// Base directory where the files will be stored
string baseDir = parameters.find("BaseDir");
if ( !exists(baseDir) )
create_directory(baseDir);
// Subject name
string subjectName = parameters.find("SubjectName");
// Principal streams file
string transformationFileName("transformationFile_");
string trialFileName("trialFile_");
string anglesFileName("anglesFile_");
string responseFileName("responseFile_");
// Add the subject name to file extension
transformationFileName +=string(subjectName)+".txt";
trialFileName +=string(subjectName)+".txt";
anglesFileName +=string(subjectName)+".txt";
responseFileName +=string(subjectName)+".txt";
// Check for output file existence
/** Transformation file **/
if ( !fileExists((baseDir+transformationFileName)) )
transformationFile.open((baseDir+transformationFileName).c_str() );
/** Trial file **/
if ( !fileExists((baseDir+trialFileName)) )
trialFile.open((baseDir+trialFileName).c_str());
/** Angles file **/
if ( !fileExists((baseDir+anglesFileName)) )
anglesFile.open((baseDir+anglesFileName).c_str());
/** Response file **/
if ( !fileExists((baseDir+responseFileName)) )
responseFile.open((baseDir+responseFileName).c_str());
#endif
cerr << "streams end" << endl;
}