The methods WriteToConsole
and WriteCharToConsole
call the windows API method WriteConsole
and reset the output buffer.
void OG_constreambuf::WriteToConsole()
{
DWORD dwCharsToWrite = pptr() - pbase();
DWORD dwCharsWritten;
if (pbase() != pptr())
{
WriteConsole(hConsoleOut, pReserve, dwCharsToWrite,
&dwCharsWritten, NULL);
setp(pbase(), epptr());
}
}
void OG_constreambuf::WriteCharToConsole(int c)
{
DWORD dwCharsWritten;
int c1 = c;
WriteConsole(hConsoleOut, &c1, 1, &dwCharsWritten, NULL);
}