realpath() - resolve pathnames
#include <stdlib.h>
char * realpath(const char *path, char *resolved)
The realpath(3) call takes a path as an argument and returns (in the resolved buffer) the actual path. It resolves multiple concurrent slashes, directory components such as . and .. and symbolic links. It resolves the path by executing chdir(2) and stat(2).
The realpath(3) call takes the following arguments:
On success, the realpath(3) call returns a pointer to resolved; on failure, it returns NULL and sets errno to indicate the error. The resolved buffer will contain the intermediate pathname which caused the error.
The realpath(3) call can fail for the following reasons:
chdir(2)
stat(2)