Internationalization and localization tools


File and Path Function

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);

void _tsplitpath(const TCHAR *path, TCHAR *drive, TCHAR *dir, TCHAR *fname, TCHAR *ext);

Internationalization (I18n) Function Overview

The _splitpath function splits the full path pointed to by path, into its constituent components. It automatically handles multibyte-character string arguments as appropriate, recognizing multibyte-character sequences according to the multibyte code page currently in use.

To ensure that there is enough room in the buffers (drive, dir, fname and ext), set their respective sizes to _MAX_DRIVE, _MAX_DIR, _MAX_FNAME, and _MAX_EXT characters. For components not found in path, _splitpath will set these arguments to empty, null-terminated strings. Pass a NULL pointer for any component that is not required.

_wsplitpath is the wide-character version of _splitpath; its arguments are wide-character strings.

_tsplitpath is the Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either _splitpath or _wsplitpath.

I18n Issues

Use the appropriate version of the function as required for internationalization support, noting the following:

Ensure that the output buffers have enough room to hold multibyte or wide-character strings, as required. See Locale-Sensitive Length Functions for a discussion on multibyte character sizes.

In an MBCS application, the _splitpath function depends on the multibyte code page in effect. By default, the multibyte code page is set to the system-default ANSI code page obtained from the operating system at program startup. Use _getmbcp and _setmbcp to query or change the current multibyte code page, respectively.

See Pathnames for a discussion of path and filename considerations in an internationalized application.

Recommended Function Replacements

File and Path Functions

 

Lingoport internationalization and localization services and software