Author: Stan Eisenstat
Subject: Re: [Cs323] Dir.c follow-up
Date: Sunday, 13 Sep 2020, 16:37:45
> Message Posted By: Unknown
>
> Sorry, let me clarify. If I replace the path in Dir.c and run the
> executable, all calls to lstat fail. Ex: char *name="anotherdir". Running
> this version of Dir results in nothing being printed due to lstat
> failures. Why is that?
That is because lstat() requires a full absolute or
relative pathname for the file, not its local name
as is returned by readdir(). Dir.c only works for
"." because FILENAME and ./FILENAME are equivalent.
--Stan-
PREV
INDEX
NEXT