我在控制台程序建立了一个新的缓冲区,用readConsoleOutputCharacterA实现的,但是现在的问题是,用system函数改变了控制台窗口大小后,换行符就不输出,没有换行的作用,或者说占据了很多空格,这是怎么回事,我应该怎么做
以下是实现的部分代码:
HANDLE hOutBuf = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
SetConsoleActiveScreenBuffer(hOutBuf);
DWORD bytes = 0;
char data [ 800 ] ;
for (char c = 'A'; c <= 'Z'; c++)
{
system("cls");
for (int j = 0; j < 600; j++) {
printf("%c", c);
if (j >= 100 && j % 100 == 0)
printf("\n%d" , j );
}
cout << "\nbytes is " << bytes;
ReadConsoleOutputCharacterA(hOutput, data, 300, coord, &bytes);
WriteConsoleOutputCharacterA(hOutBuf, data, 300, coord, &bytes);
system("pause");
}
![图片说明](https://img-ask.csdn.net/upload/201704/17/1492388180_162720.png)