The path parsing library module has the file name path.c. This module provides functions to split and join components of a directory path.
Here is a list of functions in the path parsing library module:
The following modules are required along with this module:
Just make sure you compile and link this module along with the other required modules.
This module requires the header files:
Prototype : int path_split(char *pin, int hf, char *drive, char *p, char *fn) Parameters : Name : pin Description: input path Name : hf Description: has file name in path? Name : drive Description: returned drive letter Name : p Description: returned path Name : fn Description: returned file name Returns : TRUE upon success, FALSE otherwise
This function will split a directory path into its component parts (drive letter, path and file name). The parts are returned in the returned drive letter, returned path and returned file name. The returned drive letter is always an empty string in Unix/Linux/QNX/BSD systems. All returned components must be allocated to sufficient size by the caller. The input path must be supplied in absolute form, not in relative form. The last component of the input path is assumed to be the file name if the has file name in path flag is high. If the file name is not present, a NULL pointer may be passed for the returned file name.
Prototype : int path_join(char drive, char *path, char *fname, char *pout) Parameters : Name : drive Description: input drive letter Name : path Description: input directory path Name : fname Description: input file name Name : pout Description: returned path Returns : TRUE upon success, FALSE otherwise
This function will join a path from it's component parts (drive letter, path and file name). Under Windows and DOS operating systems, the input drive letter is required to be a single alphabetic character representing the drive letter. The input directory path must not begin with a path separator. Upon success the joined path will be placed into the returned path which must already be allocated to sufficient size by the caller. The input file name may be a NULL pointer which indicates no file name present.