Expand|Select|Wrap|Line Numbers
- 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