When you create a c++ console application, there is already a Std output buffer in the console window created. Is there anyway to get the size of that buffer or its handle so I could manipulate it with functions like WriteConsoleOutputCharacter?
Printable View
When you create a c++ console application, there is already a Std output buffer in the console window created. Is there anyway to get the size of that buffer or its handle so I could manipulate it with functions like WriteConsoleOutputCharacter?
I don't think stdout is a buffer. It is a handle for a pseudo-file. I talk of stdout, like inCode:fprintf(stdout, "Hello, world!");
So there's no console buffer? Even if it is some sort of pseudo-file, given the console buffer you can take over that buffers standard output and put what you want there. I guess my question really is, what's the handle for the initial Console Buffer in a newly created console window?Quote:
Originally Posted by olivthill
If you mean Windows, and you use WinAPI, there is a set of console functions: http://msdn.microsoft.com/en-us/libr...73(VS.85).aspx . You can use GetStdHandle to receive handle to an input/output device, or GetConsoleScreenBufferInfo[Ex] to receive console buffer info.
If you do not mean Windows, or not WinAPI, then I do not know. :)
Cheers
I knew about those, but I should've thought more about GetStdHandle and GetConsoleScreenBufferInfo. My solution was to do this:Quote:
Originally Posted by Hobson
Which works, so thanks to everyone for their help.Code:HANDLE hMap = GetStdHandle(STD_OUTPUT_HANDLE);