Thread: Checking if a path exists

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    32

    Checking if a path exists

    Can some1 pls answer me if there is any function of how to check if a path exists or not?

    That is for example passing a function "/tmp" will show that it exists, however passign it "/gg" will fail if it does not exist....

    Thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    See if opendir() fails to open it - for directories
    Or maybe fopen() for files.
    Or use the fstat() function...
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    32
    sorted it out... thx salem

  4. #4
    .
    Join Date
    Nov 2003
    Posts
    307
    You may also want to consider access().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  2. Checking if file exists?
    By Neo1 in forum C++ Programming
    Replies: 8
    Last Post: 08-16-2007, 04:06 PM
  3. Problems about gcc installation
    By kevin_cat in forum Linux Programming
    Replies: 4
    Last Post: 08-09-2005, 09:05 AM
  4. Checking if a window (by title!) exists?
    By willkoh in forum Windows Programming
    Replies: 2
    Last Post: 04-02-2005, 06:26 AM
  5. Checking to see if a file exists...
    By Util_Mark in forum C++ Programming
    Replies: 1
    Last Post: 07-05-2002, 04:01 PM