Thread: How to check if a file exists

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    73

    How to check if a file exists

    How do I check if a file exists in my program?

  2. #2

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    try opening it with an ifstream. If it fails it can't be open. If it can't be opened there is a better then normal chance it doesn't exist

  4. #4
    Registered User
    Join Date
    Dec 2004
    Posts
    73
    Thank you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  4. check if the file exists
    By ipe in forum C Programming
    Replies: 2
    Last Post: 03-15-2003, 09:18 AM
  5. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM