Internationalization and localization tools


File and Path Function

int stat(const char *path, struct _stat *buffer);

int _stat(const char *path, struct _stat *buffer);

int _wstat(const wchar_t *path, struct _stat *buffer);

int _tstat(const TCHAR *path, struct _stat *buffer);

Internationalization (I18n) Function Overview

The stat function retrieves file or directory information for path and stores it in buffer. The function returns 0 if successful; otherwise, it returns -1 and sets the global errno variable to ENOENT, indicating that the filename or path could not be found.

_stat is the same as stat, supported on Windows platforms. It automatically handles multibyte-character string arguments as appropriate, recognizing multibyte-character sequences according to the multibyte code page currently in use.

Also, on Windows platforms, _wstat is the wide-character version of _stat; its argument is a wide-character string. There is no ANSI wide-character equivalent.

_tstat is the Windows-only Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either _stat or _wstat.

I18n Issues

Use the appropriate version of the function as required for internationalization support.

On ANSI UTF-16 platforms, use a conversion function to convert the wide-character string to a multibyte-character string and then call stat.

The Windows _stat 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 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