1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Directrory control functions in C

Discussion in 'C' started by Manarg, Oct 16, 2007.

  1. Manarg

    Manarg New Member

    Joined:
    Jun 18, 2007
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    Hello. Is there any function that can specify if a given path points to a directory or to a file? I want it to work in Unix-based operating systems. Any help will be appreciated! Thanx in advance.
     
  2. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    See the stat function.
     
  3. Manarg

    Manarg New Member

    Joined:
    Jun 18, 2007
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    i was used the stat function but when the path is a directory the st_mode element of the stat struct does not get the S_IFDIR value but a value close to that (on int). why is this happening?
    is it safe to use a range of values for directories and another range for values or i might get unexpected results?
    (actually i want to test weather a given path is a file or a directory).
     
  4. Manarg

    Manarg New Member

    Joined:
    Jun 18, 2007
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    had many mistakes... quik writing. sorry for that! :D
     

Share This Page