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

  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
    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, 09:35 AM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02: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, 05:56 AM