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

mod rewrite - Using "?" when rewriting the URL -

.htaccess: Transfer name to index.php if not directory public -

Admob integration with pygame in android -