How would I do this...? (file I/O)

This is a discussion on How would I do this...? (file I/O) within the C++ Programming forums, part of the General Programming Boards category; Return a variable as 0 if a file does not exist, 1 if it does exist. Thanks...

  1. #1
    rm3
    Guest

    How would I do this...? (file I/O)

    Return a variable as 0 if a file does not exist, 1 if it does exist.

    Thanks

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    Create a function that tries to open the file with a ifstream object (make sure you use the standard headers). Test whether the file is open with ifstream::is_open(). Return one if is_open() returns non-zero or zero if it returns zero.
    zen

  3. #3
    rm3
    Guest

    Smile :D

    Yes, and how exactly would I do that?

    I know what functions are etc./ but how would I use the function you talked about?

    thanks for helping

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  3. 2 questions surrounding an I/O file
    By Guti14 in forum C Programming
    Replies: 2
    Last Post: 08-30-2004, 11:21 PM
  4. File I/O problems!!! Help!!!
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 05-17-2002, 08:09 PM
  5. advice on file i/o
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-29-2001, 04:56 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21