what would i do to find if a file was already made?
for example
etc....Please help!Code:fstream a_file("data.dat") return(a_file.open()); if(FALSE)
what would i do to find if a file was already made?
for example
etc....Please help!Code:fstream a_file("data.dat") return(a_file.open()); if(FALSE)
>>what would i do to find if a file was already made
Do you mean you want to check is a file exists?
For a standard way, open it in read mode, if it fails, the chances are it doesn't exist (but there could be other reasons).
For a non-standard way, use a compiler specific function that will give you additional information, maybe you have stat()?
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
Exactly. Then I want it to return true or false or something like that so I can use an if(FALSE) command.Do you mean you want to check is a file exists?
Start from here (or something similar):
Code:ifstream checker; checker.open("junk1.c"); if (checker) cout <<"junk1.c exists" <<endl; else cout <<"junk1.c does not exist" <<endl; checker.close();
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]