Mail Archives: djgpp/2001/03/06/08:36:37.2
Abacuc <f DOT onorati AT tiscalinet DOT it> wrote:
> How can i distinguish a file or a directory?
Within the DJGPP framework, stat() and fstat() are the proper answer.
For an "extremely portable" program, you cannot do this at all, since
the ANSI C standard doesn't even assume there is any such thing as a
"directory". To it, a filename is an opaque entity without further
structure inside. Only in the realm of other, less widely applicable
standards, like POSIX, you have functions like opendir()/readdir() to
work with directories.
> And how can I know the extensions of the files (exe, com, jpg,
> etc.)?
That's simple: use strcmp() or strstr() to search for them in the
filenames, once you have them.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -