My program has to load a file named "x" everytime it is executed.(not from the command line,but from the directory it is in)The first time it is executed there exists no such file,but on the further executions there exists.How can I do this job?
My program has to load a file named "x" everytime it is executed.(not from the command line,but from the directory it is in)The first time it is executed there exists no such file,but on the further executions there exists.How can I do this job?
//If the file doesn't exist, fstream will create it.
#include <iostream.h>
#include <fstream.h>
int main()
{
char buffer[100];
ifstream FileReader("C:\\whatever.txt");
FileReader>>buffer;
cout<<"whatever.txt: "<<buffer<<"\n";
FileReader.close();
return 0;
}
Last edited by CodeMonkey; 11-22-2001 at 01:41 PM.
"If you tell the truth, you don't have to remember anything"
-Mark Twain