|
4.17. symlink and readlink FunctionsA symbolic link is created with the symlink function.
A new directory entry, sympath, is created that points to actualpath. It is not required that actualpath exist when the symbolic link is created. (We saw this in the example at the end of the previous section.) Also, actualpath and sympath need not reside in the same file system. Because the open function follows a symbolic link, we need a way to open the link itself and read the name in the link. The readlink function does this.
This function combines the actions of open, read, and close. If the function is successful, it returns the number of bytes placed into buf. The contents of the symbolic link that are returned in buf are not null terminated. |
|