Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Directrory control functions in C (http://www.go4expert.com/forums/directrory-control-functions-c-t6865/)

Manarg 16Oct2007 17:14

Directrory control functions in C
 
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.

DaWei 16Oct2007 18:22

Re: Directrory control functions in C
 
See the stat function.

Manarg 16Oct2007 21:40

Re: Directrory control functions in C
 
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).

Manarg 16Oct2007 21:53

Re: Directrory control functions in C
 
Quote:

Originally Posted by Manarg
i 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 **files or i might get unexpected results?
.

had many mistakes... quik writing. sorry for that! :D


All times are GMT +5.5. The time now is 15:24.