From 744d118768468b959cb0ddfff03e5e8c808082bd Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 1 Jul 2005 19:52:43 +0000 Subject: [PATCH] Document Windows lossage and work-around. --- src/client/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/client/main.c b/src/client/main.c index 7c841823..a59f286b 100644 --- a/src/client/main.c +++ b/src/client/main.c @@ -109,6 +109,14 @@ main(int ac, char **av) int utf8 = 0; #ifdef _WIN32 + /* + * stdout is unbuffered under Windows if connected to a character + * device, and putchar() screws up when printing multibyte strings + * bytewise to an unbuffered stream. Switch stdout to line- + * buffered mode. Unfortunately, ISO C allows implementations to + * screw that up, and of course Windows does. Manual flushing + * after each prompt is required. + */ setvbuf(stdout, NULL, _IOLBF, 4096); err = WSAStartup(0x0101, &WsaData); if (err == SOCKET_ERROR) {