For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
Break a path name into components. More secure versions of these functions are available, see _splitpath_s, _wsplitpath_s.
void _splitpath( const char *path, char *drive, char *dir, char *fname, char *ext ); void _wsplitpath( const wchar_t *path, wchar_t *drive, wchar_t *dir, wchar_t *fname, wchar_t *ext );
Drive letter, followed by a colon (
:). You can pass
NULL for this parameter if you do not need the drive letter.
Directory path, including trailing slash. Forward slashes (
/ ), backslashes (
\ ), or both may be used. You can pass
NULL for this parameter if you do not need the directory path.
Base filename (no extension). You can pass
NULL for this parameter if you do not need the filename.
Filename extension, including leading period (
.). You can pass
NULL for this parameter if you do not need the filename extension.
_splitpath function breaks a path into its four components.
_splitpath automatically handles multibyte-character string arguments as appropriate, recognizing multibyte-character sequences according to the multibyte code page currently in use.
_wsplitpath is a wide-character version of
_splitpath; the arguments to
_wsplitpath are wide-character strings. These functions behave identically otherwise.
Security Note These functions incur a potential threat brought about by a buffer overrun problem. Buffer overrun problems are a frequent method of system attack, resulting in an unwarranted elevation of privilege. For more information, see Avoiding Buffer Overruns. More secure versions of these functions are available; see _splitpath_s, _wsplitpath_s.
|TCHAR.H routine||_UNICODE & _MBCS not defined||_MBCS defined||_UNICODE defined|
Each component of the full path is stored in a separate buffer; the manifest constants
_MAX_EXT (defined in STDLIB.H) specify the maximum size for each file component. File components that are larger than the corresponding manifest constants cause heap corruption.
Each buffer must be as large as its corresponding manifest constant to avoid potential buffer overrun.
The following table lists the values of the manifest constants.
If the full path does not contain a component (for example, a filename),
_splitpath assigns empty strings to the corresponding buffers.
You can pass
_splitpath for any parameter other than
path that you do not need.
NULL, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue,
errno is set to
EINVAL and the function returns
|<stdlib.h> or <wchar.h>|
For additional compatibility information, see Compatibility in the Introduction.
See the example for _makepath.
Not applicable. To call the standard C function, use
PInvoke. For more information, see Platform Invoke Examples.