readlink - read value of a symbolic link
#include <unistd.h>
int readlink(const char *path, char *buf, size_t bufsiz);
readlink(2) places the contents of the symbolic link path in the buffer buf, which has size bufsiz. readlink does not append a NUL character to buf. It will truncate the contents (to a length of bufsiz characters), in case the buffer is too small to hold all of the contents.
The call returns the count of characters placed in the buffer if it succeeds, or a -1 if an error occurs, placing the error code in errno.
X/OPEN, 4.4BSD (the readlink(2) function call appeared in 4.2BSD).
11 pages link to readlink(2):