
April 20th, 2003, 10:21 PM
|
|
Junior Member
|
|
Join Date: Apr 2003
Location: Toronto, Canada
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I am fairly new to C/C++, but one alternative would be to check if you can open the file or not.
Sample code:
int checkFile(char filename[]) {
FILE* fp; // file pointer
int retval; // return value
fp=fopen(filname, "r"); // open file for reading
if (fp) // check if file was opened successfully or not
retval=1;
else
retval=0;
return retval; // return 1 or 0
}
Basically, if the file already exists, then you will be able to open it. If it doesn't exist, then opening will "fail".
Hope this helps
Cools
Last edited by coolman0stress : April 20th, 2003 at 10:23 PM.
|