Internationalization and localization tools


File and Path Function

char *_getdcwd(int drive, char *buffer, int maxlen);

wchar_t *_wgetdcwd(int drive, wchar_t *buffer, int maxlen);

TCHAR *_tgetdcwd(int drive, TCHAR *buffer, int maxlen);

Internationalization (I18n) Function Overview

The _getdcwd function copies an absolute pathname of the current working directory on the specified drive to the array pointed to by buffer, which is of maxlen byte size, and returns a pointer to the result.

buffer can be NULL, in which case, an array is allocated using malloc to store the path. This buffer can later be freed by calling free and passing it the _getdcwd return value (a pointer to the allocated buffer).

In the event of an error, NULL is returned, and the global error errno is set either to ENOMEM, indicating that there is insufficient memory to allocate maxlen bytes (when a NULL is given as buffer), or to ERANGE, indicating that the path (including the terminating null character) is longer than maxlen bytes.

_wgetdcwd is the wide version of the function; its string parameter and return are wide character strings, and maxlen is the size of buffer in wide characters, rather than single-byte characters.

_tgetdcwd is the Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either _getdcwd or _wgetdcwd.

I18n Issues

Use the appropriate version of the function as required for internationalization support, ensuring that maxlen is correct for the chosen platform. See Locale-Sensitive Length Functions for a discussion on single-byte and wide character sizes.

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

Recommended Replacements*

*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.

File and Path Functions

 

Lingoport internationalization and localization services and software