Results 1 to 2 of 2

Thread: Testing to see if a file exists

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    3
    How can I test to see if a fil exists or is empty using the fstream.h library?

    Thanks.

  2. #2
    New Member
    Join Date
    Jul 2000
    Posts
    3
    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
    Wulf
    "When in doubt, change something"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width