int FLfullName (const char Fname[], char Fullname[])


Expand a file name path


This routine takes an input file name with path and tries to expand it to form a file name with an absolute path. The typical use of this routine is to log the full file name of a file that has already been opened, and hence for which the path is well defined and readable.

The basic strategy is to take the path and try to temporarily change the current working directory to this path. If this is unsuccessful, the rightmost component of the path is removed and the process is repeated. When (if) successful, the leftmost components are replaced by the working directory name. This results in a resolved, cleaned up path name. The rightmost components are appended to this to form the full path name.

Note that ~ characters in the file name are treated as ordinary characters.


<- int FLfullName
Number of characters in the output string
-> const char Fname[]
Input character string with the file or directory name. An empty string gives the current working directory.
<- char Fullname[]
Output string with the file name with resolved path name. This string is at most FILENAME_MAX characters long including the terminating null character. This string will be the same as the input file name if the path cannot be resolved.

Author / revision

P. Kabal / Revision 1.42 2003/05/09

See Also


Main Index libtsp