![]() SetConsoleTextAttribute(GetStdHandle(STD_ERROR_HANDLE), FOREGROUND_RED | FOREGROUND_INTENSITY) LStdHandle = (long)GetStdHandle(STD_ERROR_HANDLE) ![]() redirect unbuffered STDERR to the console LStdHandle = (long)GetStdHandle(STD_INPUT_HANDLE) redirect unbuffered STDIN to the console HConHandle = _open_osfhandle(lStdHandle, _O_TEXT) LStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE) redirect unbuffered STDOUT to the console SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize) GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo) set the screen buffer to be big enough to let us scroll text Can anyone help about this? int hConHandle įreeConsole() // be sure to release possible already allocated consoleĮRROR_WINDOW("Cannot allocate windows console!") I also tried to use the "HANDLE" type for lStdHandle but then it even does not compile. Surely, the best would be some win32/win64 independent solution. However since I don't know the exact purpose and size of some windows API types, so I can't figure out what I should change. I guess the problem is the different long integer data type size, gcc even warns about this. It works well with Win32, but the program crashes on Win64. ![]() After digging the Net (and even asking a question here) I've managed to put a code fragment together which can open a windows console, and use it for stdin/stdout/stderr. First of all, I'm not a Windows programmer (not even a Windows user), I use cross-compiler on Linux to build also for Win32 and Win64.
0 Comments
Leave a Reply. |