SetFileApisToANSI
The SetFileApisToANSI
function causes a set of Win32 file functions to use the ANSI character set
code page. This function is useful for 8-bit console input and output
operations.
VOID SetFileApisToANSI (VOID)
Parameters
This function
has no parameters.
Return Values
This function
has no return value.
Remarks
The SetFileApisToANSI
function complements the SetFileApisToOEM1NAIDV3 function, which causes the same set of
Win32 file functions to use the OEM character set code page.
The 8-bit
console functions use the OEM code page by default. All other functions use the
ANSI code page by default. This means that strings returned by the console
functions may not be processed correctly by other functions, and vice versa.
For example, if the FindFirstFileA5_0W_R1 function will not display the string
properly.
Use the AreFileApisANSI
To solve the
problem of code page incompatibility, it is best to use Unicode for console
applications. Console applications that use Unicode are much more versatile
than those that use 8-bit console functions. Barring that solution, a console
application can call the SetFileApisToOEM
SetFileApisToANSI and SetFileApisToOEM affect these Win32
functions:
_lopen |
GetDriveType |
LoadLibrary |
CopyFile |
GetFileAttributes |
LoadLibraryEx |
CreateDirectory |
GetFullPathName |
MoveFile |
CreateFile |
GetModuleFileName |
MoveFileEx |
CreateProcess |
GetModuleHandle |
OpenFile |
DeleteFile |
GetSystemDirectory |
RemoveDirectory |
FindFirstFile |
GetTempFileName |
SearchPath |
FindNextFile |
GetTempPath |
SetCurrentDirectory |
GetCurrentDirectory |
GetVolumeInformation |
SetFileAttributes |
GetDiskFreeSpace |
GetWindowsDirectory |
|
When dealing
with command lines, a console application should obtain the command line in
Unicode form, and then convert it to OEM form using the relevant
character-to-OEM functions. Note also that the argv function uses the
ANSI character set.
See Also