validating a directory pathname

This is a discussion on validating a directory pathname within the C Programming forums, part of the General Programming Boards category; Hi, what function do we use to check if a path given as a argument is correct? Thanks...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    31

    validating a directory pathname

    Hi,

    what function do we use to check if a path given as a argument is correct?

    Thanks

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    the most portable way is to open a new file for writing in the directory -- if open failes than the directory either does not exist or you don't have write premission in the directory.

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    31
    Where can we find a list of functions to perform directory or file related operations?

  4. #4
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682
    look up stdio.h header file u get most of the file handling fucntion residing there

    ssharish2005

  5. #5
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    also google for fopen, fgets, fread, fwrite, fprintf, etc -- you will find a lot of information about how to use those functions -- they are standard for all C compliant compilers on most operating systems.

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,494
    > Where can we find a list of functions to perform directory
    There are no standard directory manipulation functions, you need to say which OS/Compiler you have.

    Most systems should have opendir/readdir/closedir

    File functions are standard, see Ancient Dragon's post.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to tell if a file or directory
    By swappo in forum C++ Programming
    Replies: 4
    Last Post: 07-07-2009, 10:57 AM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  3. Couple errors please help :-D
    By JJJIrish05 in forum C Programming
    Replies: 9
    Last Post: 03-06-2008, 01:54 AM
  4. Replies: 6
    Last Post: 07-30-2003, 03:08 AM
  5. Directory reading trouble
    By samGwilliam in forum Linux Programming
    Replies: 0
    Last Post: 03-10-2002, 08:43 AM

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