READLINK(2)

NAME
readlink - read the contents of a symlink

SYNOPSIS
#include <unistd.h>
int readlink(const char *path, char *buf, size_t bufsize)

DESCRIPTION
The readlink call reads the contents of the symlink name1 and returns it in buf up to a maximum of bufsize bytes. A terminating NUL byte is NOT put in the buffer.

RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.

ERRORS
Readlink will fail if one or more of the following are true:

[ENOTDIR]
    A component of either path prefix is not a directory.

[ENAMETOOLONG]
    A path name exceeds PATH_MAX characters.

[ENOENT]
    A component of the path does not exist.

[EACCES]
    A component of the path denies search permission.

[ELOOP]
    Too many symbolic links were encountered in translating one of the pathnames.

[ENOENT]
    The link named by path does not exist.

[EFAULT]
    The buffer specified is outside the process's allocated address space.

SEE ALSO
symlink(2), unlink(2).