-
March 13th, 2014, 11:39 AM
#1
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;
}
What the mind can conceive it can achieve.
-
March 13th, 2014, 11:40 AM
#2
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;}
What the mind can conceive it can achieve.
-
March 13th, 2014, 11:41 AM
#3
Re: Test post with code or php?
What the mind can conceive it can achieve.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|