Test post with code or php?
Code:
int main()
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
int width = csbi.dwSize.X;
int height = csbi.dwSize.Y;
char *pchScreenBuffer;
// Dynamically allocate a screen buffer - Used by GetText() and PutText()
// We need width * height * 2, as we need space for the character and
// it's attribute.
if(!(pchScreenBuffer = new char[width * height * 2])) {
MessageBox(NULL, "Error creating a dynamic screen buffer.",
"Error", MB_ICONERROR | MB_OK | MB_TASKMODAL);
exit(1);
}
// Put some text on the screen to copy
std::cout << "Hello, this is some text that I am going to copy"
<< " \nand then place back on the screen. Will need to"
<< " \ntest the code to make sure it is working as I"
<< " \nhave designed it. So far I have not managed to"
<< " \nget these two functions to work correctly?" << std::endl;
// Let's test the functions
GetText(0, 0, 5, 3, pchScreenBuffer);
PutText(0, 0, 5, 3, pchScreenBuffer);
delete[] pchScreenBuffer; // Free dynamic memory
return 0;
}
Re: Test post with code or php?
PHP Code:
int main(){ CONSOLE_SCREEN_BUFFER_INFO csbi; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
int width = csbi.dwSize.X; int height = csbi.dwSize.Y;
char *pchScreenBuffer;
// Dynamically allocate a screen buffer - Used by GetText() and PutText() // We need width * height * 2, as we need space for the character and // it's attribute. if(!(pchScreenBuffer = new char[width * height * 2])) { MessageBox(NULL, "Error creating a dynamic screen buffer.", "Error", MB_ICONERROR | MB_OK | MB_TASKMODAL); exit(1); }
// Put some text on the screen to copy std::cout << "Hello, this is some text that I am going to copy" << " \nand then place back on the screen. Will need to" << " \ntest the code to make sure it is working as I" << " \nhave designed it. So far I have not managed to" << " \nget these two functions to work correctly?" << std::endl;
// Let's test the functions GetText(0, 0, 5, 3, pchScreenBuffer); PutText(0, 0, 5, 3, pchScreenBuffer);
delete[] pchScreenBuffer; // Free dynamic memory
return 0;}
Re: Test post with code or php?