Yeah, that helps, but I still want to know for my next programs, what to do if the text IS interactive...
You can try to resort to the SetConsoleScreenBufferSize()
function, as suggested by nezachem. It is actually quite simple, so maybe try running the below code and see how it works.
#include <stdio.h>
#include <windows.h>
int main(int argc, char *argv[])
{
/* Initialize the screen buffer info to zero */
CONSOLE_SCREEN_BUFFER_INFO info = {0};
/* You need the console's std output handle */
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
if(hStdOut == INVALID_HANDLE_VALUE)
{
/* No luck */
printf("GetStdHandle() failed, error: %lu\n", GetLastError());
return 0;
}
/* Get the current settings ... */
if( ! GetConsoleScreenBufferInfo(hStdOut, &info))
{
/* No luck */
printf("GetConsoleScreenBufferInfo() failed, error: %lu\n",
GetLastError());
return 0;
}
/* Adjust this to your likings, info.dwSize.Y is a SHORT,
* so, keep within the limits of a SHORT.
* SHRT_MAX is defined in <limits.h>
*/
info.dwSize.Y = SHRT_MAX - 1;
/* Interestingly, seems that SHRT_MAX - 1 is the maximum
* working value instead of SHRT_MAX.
*/
/* Apply your new settings ... */
if( ! SetConsoleScreenBufferSize(hStdOut, info.dwSize))
{
/* No luck */
printf("SetConsoleScreenBufferSize() failed, error: %lu\n",
GetLastError());
return 0;
}
/* Print lines up to the maximum, once finished,
* you should still be able to see the first line printed.
*/
for(int ii = 0; ii < info.dwSize.Y; ++ii)
{
printf("\nline# %d", ii);
}
getchar();
return 0;
}
If you want to increase the number of characters that fit …