c++ - ReadConsoleOutputCharacter gives ERROR_NOT_ENOUGH_MEMORY when requesting more than 0xCFE1 characters, is there a way around that? -
the code:
#include <windows.h> #include <stdio.h> int main() { system("mode 128"); int range = 0xcfe2; char* buf = new char[range+1]; dword dwchars; if (!readconsoleoutputcharacter( getstdhandle(std_output_handle), buf, // buffer store symbols range, // read len chars {0,0}, // read row=8, column=6 &dwchars // how many symbols stored )) { printf("getlasterror: %lu\n", getlasterror()); } system("pause"); return 0; }
console screen buffers cannot larger 64k. each character in buffer requires 2 bytes, 1 character code , color attributes. therefore never makes sense try read more 32k chars readconsoleoutputcharacter().
you don't have real problem.
Comments
Post a Comment