Checking if a path exists

This is a discussion on Checking if a path exists within the Linux Programming forums, part of the Platform Specific Boards category; Can some1 pls answer me if there is any function of how to check if a path exists or not? ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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, 05: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

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