Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

SplitPath

LabWindows/CVI 8.5 Help
November 2007

NI Part Number:
370051K-01

»View Product Info

void SplitPath (char pathName[], char driveName[], char directoryName[], char fileName[]);

Purpose

Splits a pathname into the drive name, the directory name, and the filename.

Example

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" */

Parameters

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.

Return Value

None.


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit