howto find files in code

Started by
1 comment, last by RPTD 20 years ago
i`m writing POSIX compatible code for my project but ran into one stoopid problem... how can i find files in my code? POSIX allows for file operation like fopen and such, that works, and for directory reading it has readdir and co. problem is only that readdir doesn`t tell me (or at least i can`t be assured a POSIX system can tell me), if a directory entry is a file or directory. anybody knows if there is a portable function for this or do i have to #ifdef my way to success?

Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine

Advertisement
stat (look into it''s man pages)
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon
i've seen this one, yeah.
only drawback is that i have to construct a full string each time i wanna check the file.
i hoped there is a shorter way (ok... except you chdir your way through, and except dirent struct has a d_type field).

[edited by - RPTD on March 23, 2004 3:39:48 PM]

Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine

This topic is closed to new replies.

Advertisement