How can I test to see if a fil exists or is empty using the fstream.h library?
Thanks.
Printable View
How can I test to see if a fil exists or is empty using the fstream.h library?
Thanks.
fstream(file_name,ios::in|ios::nocreate,NULL);
if( is_open() ){
close();
do opened stuff
}
else{
do closed stuff
}
Thats an existance test, an empty test probably requires other functions. I like using fopen/fread/fwrite/fclose