I'll skip the nitty gritty, but here's the outline of the program
So when I run my code using only one file (test.txt, for example) the program works fine and does exactly what it needs to do.
However, if multiple files are written in, say with a dummy file B
a.out B test.txt
B shows an invalid file...but so does test.txt, which we already know works.
Also, something with two valid files
a.out test.txt test1.txt
this will simply run the first file no problem, but when it gets to the second file (simply a copy of test.txt) it reports that it's unable to open
Is there something wrong with closing the files? I have close statements in the bulk section of the program
Help is greatly appreciated,
-Myxamatosis
Code:
int main( int Argc, char *Arg[])
{
ifstream indata;
cout << "Command line contained " << Argc << " tokens\n\n";
cout << "Name of executing file: " << Arg[0] << "\n";
for (int I=1; I<Argc; I++)
{
cout << "Attempting to open " << Arg[I] << "..." << endl;
indata.open(Arg[I]);
if ( !indata )
{
cerr << "Error: File could not be opened"
}
else
{
(REST OF PROGRAM)
}
}
}
However, if multiple files are written in, say with a dummy file B
a.out B test.txt
B shows an invalid file...but so does test.txt, which we already know works.
Also, something with two valid files
a.out test.txt test1.txt
this will simply run the first file no problem, but when it gets to the second file (simply a copy of test.txt) it reports that it's unable to open
Is there something wrong with closing the files? I have close statements in the bulk section of the program
Help is greatly appreciated,
-Myxamatosis
Comment