1 /* $XConsortium: ConsoleOutput.C /main/1 1996/07/29 16:48:10 cde-hp $ */
2 // Copyright (c) 1996 James Clark
3 // See the file COPYING for copying permission.
10 #include "ConsoleOutput.h"
18 namespace SP_NAMESPACE {
23 class ConsoleOutputCharStream : public OutputCharStream {
25 ConsoleOutputCharStream(HANDLE h);
32 OutputCharStream *ConsoleOutput::makeOutputCharStream(int fd)
34 HANDLE h = (HANDLE)_get_osfhandle(fd);
36 if (GetConsoleMode(h, &flags))
37 return new ConsoleOutputCharStream(h);
42 ConsoleOutputCharStream::ConsoleOutputCharStream(HANDLE h)
47 void ConsoleOutputCharStream::flush()
51 void ConsoleOutputCharStream::flushBuf(Char c)
54 unsigned short ch = c;
55 WriteConsoleW(h_, &ch, 1, &nWritten, 0);
58 #else /* not SP_WIDE_SYSTEM */
60 OutputCharStream *ConsoleOutput::makeOutputCharStream(int)
65 #endif /* not SP_WIDE_SYSTEM */