In my problem I have set of folders called Job1, Job2, Job3,......Jobn. In every Job folder there's another set of sub folders called Run1, Run2, .....Runm. Evrey "Run" folder has a file called "myFile.dat", which is the file I want to read and process.
I want to write a code to read every myFile.dat files. Simply I want to read "myFile.dat" in "Run1" folder in the "Job1" folder, then "myFile.dat" file in the "Run2" folder in the "Job1" folder and so on.
If anyone could help figure it out that would be appreciated
I have to do a simulation. Simulation will process set of output files for different inputfiles. For a one set of parameters I want to run the simulation for "m" times. Therefore there are "m: number of "Run" folders which contains the outputfile I want (myFile.dat).
And I want to run the simulation for "n" number of paramaters. Therefore there are "n" number of Jobs.
I want to analyse output data. Before analysing I want to calculate averages of some variables in the "myFile.dat" file and copy all the data into a one ouput file. And want to record corresponding job number and run number as well.
#include<iostream> // Input/Output stream header.
#include<fstream> // File stream header.
// Namespace standard
usingnamespace std;
// Main function.
int main()
{
// Variable declarations
int i;
ifstream infile; // Declare an input file variable called infile.
infile.open("file_name.type"); // Open the file in the same path as executable
// File test.
if (infile.fail())
{
cout << "Input file did not open." << endl;
exit(-1);
}
// Reads the first integer in the file.
infile >> i;
// Read loop.
while(infile)
{
// Stuff goes here
infile >> i; // Read again
}
// Closes the file once it is done reading.
infile.close();
return 0;
}