본문 바로가기

Windows/MFC

_splitpath, _wsplitpath

Break a path name into components. These functions are deprecated because more secure versions are available, see _splitpath_s, _wsplitpath_s.

[code]
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
);
[/code]


Parameters
path
Full path

drive
Optional drive letter, followed by a colon (:)

dir
Optional directory path, including trailing slash. Forward slashes ( / ), backslashes ( \ ), or both may be used.

fname
Base filename (no extension)

ext
Optional filename extension, including leading period (.)


Requirements
_splitpath <stdlib.h>
_wsplitpath <stdlib.h> or <wchar.h>