On 26/12/2014 18:37, Eli Zaretskii wrote:
> The speed is fine on my machines, and cputs does NOT write one
> character at a time, it uses WriteConsole. Only cprintf writes one
> character at a time.
Not according to the Visual Studio 2010 source, which is presumably
similar to what MSVCRT.DLL would use. Why else do you think you
needed to convert to UTF-16? Here's what happens on my Win7 machine:
C:\test>cat cputs.c
#include <windows.h>
#include <stdio.h>
#include <conio.h>
int main( int argc, char* argv[] )
{
DWORD written;
puts( "\xc3\xbf" );
_cputs( "\xc3\xbf\r\n" );
WriteConsole( GetStdHandle( STD_OUTPUT_HANDLE ), "\xc3\xbf\r\n", 4,
&written, NULL );
return 0;
}
C:\test>gcc -O2 -Wall cputs.c -s -o cputs.exe
C:\test>chcp 65001
Active code page: 65001
C:\test>cputs
ÿ
ÿ
ÿ
--
Jason.