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

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -