From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: directory&files Date: 6 Mar 2001 13:34:22 GMT Organization: Aachen University of Technology (RWTH) Lines: 22 Message-ID: <982p0u$mks$1@nets3.rz.RWTH-Aachen.DE> References: <980qkc$lj0$1 AT pegasus DOT tiscalinet DOT it> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 983885662 23196 137.226.32.75 (6 Mar 2001 13:34:22 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 6 Mar 2001 13:34:22 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Abacuc 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.