File types

Chet Ramey chet at odin.INS.CWRU.Edu
Fri Jan 11 00:00:09 AEST 1991


In article <127561 at linus.mitre.org> dean at snkoil.mitre.org (Dean Cookson) writes:

>Anyone know any easy way for a program to check if the argument it was
>given as an input file is a directory??  I've been using stat, but
>whatever more uses seems faster.

Stat is what more uses.  You could try opening the file for writing and
checking to see if the open fails with errno == EISDIR, but I don't think
that's any better, and it has to be less portable.

Chet
-- 
Chet Ramey				``There's just no surf in
Network Services Group			  Cleveland, U.S.A. ...''
Case Western Reserve University
chet at ins.CWRU.Edu		My opinions are just those, and mine alone.



More information about the Comp.unix.questions mailing list