CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2009
    Location
    England
    Posts
    57

    Unhappy 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.

  2. #2
    Join Date
    Jan 2009
    Location
    England
    Posts
    57

    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.

  3. #3
    Join Date
    Jan 2009
    Location
    England
    Posts
    57

    Re: Test post with code or php?

    code is better.
    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
  •  





Click Here to Expand Forum to Full Width

Featured