- Mar 26, 2001
- 431
- 0
- 71
I need to be able to read in two txt files, however the program will not know the names of the files in advance
what I want to be able to do is:
have the two input files txt files and compile my program into an executable file (called Project3, say), then call it from the command-line like this:
>> Project3 file1 file2
where file1 and file2 represent the files that someone would want read in.
the program doesnt know in advance what the file names are
I know how to code this when you know that file names and can put them into the program like this :
ifstream message("messagesfile.txt");
while (!messages.eof())
ect.
But how do i code it to expect the file names when the program is run?
does it have something to do with this :
int main(int argc, char *argv[])
Thanks for the help
what I want to be able to do is:
have the two input files txt files and compile my program into an executable file (called Project3, say), then call it from the command-line like this:
>> Project3 file1 file2
where file1 and file2 represent the files that someone would want read in.
the program doesnt know in advance what the file names are
I know how to code this when you know that file names and can put them into the program like this :
ifstream message("messagesfile.txt");
while (!messages.eof())
ect.
But how do i code it to expect the file names when the program is run?
does it have something to do with this :
int main(int argc, char *argv[])
Thanks for the help
