c - Get real path of a symlink -
suppose want real path of symlink. know both readlink
, stat
system calls can dereference link , give me real path. operate in same way (only regarding dereferencing, know stat
lots more)? should prefer 1 on other?
use stat()
tell file @ end of chain of symlinks; not path in way. use lstat()
information symlink, if any, referred to; acts stat()
when name given not symlink. use readlink()
obtain path name stored in symlink named argument (beware — it not null terminate string).
if want full pathname of file @ end of symlink, can use realpath()
. gives absolute pathname not cross symlinks reach file.
Comments
Post a Comment