void SplitPath (char pathName[], char driveName[], char directoryName[], char fileName[]);
Splits a pathname into the drive name, the directory name, and the filename.
char pathName[MAX_PATHNAME_LEN];
char driveName[MAX_DRIVENAME_LEN];
char dirName[MAX_DIRNAME_LEN];
char fileName[MAX_FILENAME_LEN];
SplitPath (pathName, driveName, dirName, fileName);
/* If pathName contains
c:\cvi\samples\apps\update.c
then
driveName contains "c:"
dirName contains "\cvi\samples\apps\"
fileName contains "update.c"
If pathName is
\\computer\share\dirname\foo.c
then
drive name is ""
directory name is "\\computer\share\dirname\"
filename is "foo.c" */
Input | ||
Name | Type | Description |
pathName | string | Pathname to split. |
Output | ||
Name | Type | Description |
driveName | string | A buffer to contain the drive name. driveName can be NULL. If not NULL, it must be of size MAX_DRIVENAME_LEN or greater. The buffer is filled with an empty string if the pathname is a UNC path, such as \\computer\share\file.c. Linux On operating systems without drive names, such as Linux, SplitPath always fills driveName with an empty string. |
directoryName | string | A buffer to contain the directory name. directoryName can be NULL. If not NULL, it must be of size MAX_DIRNAME_LEN or greater. |
fileName | string | A buffer to contain the file name. fileName can be NULL. If not NULL, it must be of size MAX_FILENAME_LEN or greater. |
None.