Hi everyone sorry for the title of the question, I know there are a lot of questions regarding reading files in C++ but I wanted to check with you if it has a different approach if the files that I am reading are being generated at run-time.
So far I can read files no problem as long as the file exists. However, if I were to run the code and the files are being generated, it doesnt matter if I do the checking of the existence of the file, it just freezes my app. I am receiving the files from another process within my application.
Not sure what am I doing wrong so I apologize if the question is too vague. (The loop for reading the next file is in my main process)
std::ifstream infile;
while(1){
infile.open(createFile(test, fileIndex), std::ios::in);
if(infile.good())
break;
}
if (infile.is_open()){
int i = 0;
while(infile >> i){
//Here I am actually plotting i in a wxWidgets App
//Using mpFXYVectors
}
Mathplot->SetData(AVG_X, AVG_Y);
Mathplot->AddLayer(AVG);
Mathplot->UpdateAll();
Mathplot->Fit();
infile.close();
}else{
//Inform the user something went wrong
}
The loop is in another class and it is a simple
while(1){
readProcess->keepItGoing(fileIndex);
fileIndex++;
if(stop==1)
break;
}
Again my apologies if it is a foolish question but I have been stuck for a while now in a reading task that it is supposed to be simple.