Im writing a school assignment in C to search through a file system for directories, regular files and symlinks. For now i use lstat
to get information about items.
So whats the difference between lstat
fstat
and stat
system calls?
I was also searching for stat vs lstat vs fstat
and although there is already an answer to this question, I'd like to see it formatted like that:
lstat()
is identical tostat()
, except that if pathname is a symbolic link, then it returns information about the link itself, not the file that it refers to.
fstat()
is identical tostat()
, except that the file about which information is to be retrieved is specified by a file descriptor (instead of a file name).