Visual C++ terminal functions

This is a discussion on Visual C++ terminal functions within the C++ Programming forums, part of the General Programming Boards category; Looking for functions for Visual C++ that are an equivalent to Borland's gettext() & puttext() ---> used to manipulate terminal ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    2

    Question Visual C++ terminal functions

    Looking for functions for Visual C++ that are an equivalent to Borland's gettext() & puttext() ---> used to manipulate terminal screen.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Look up cout and cin. Here is a simple program.

    Code:
    #include <iostream>
    using namespace std;
    
    int main( void )
    {
      int num;
    
      cout << "Enter a number: ";
      cin >> num;
    
      cout << "You enetered " << num << endl;
    
      return 0;
    }
    Let me know if you have any questions.

  3. #3
    Registered User shuesty's Avatar
    Join Date
    Oct 2002
    Posts
    21
    from what I'm understanding you are looking for printf and scanf

    ex

    printf("Hello World");
    or
    x = "Hello World";
    printf("%s" ,x);

    and

    int i;
    scanf("%d" ,&i);

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Originally posted by shuesty
    from what I'm understanding you are looking for printf and scanf

    ex

    printf("Hello World");
    or
    x = "Hello World";
    printf("%s" ,x);

    and

    int i;
    scanf("%d" ,&i);
    Yes, but he posted this on the C++ board.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  5. #5
    BMJ
    BMJ is offline
    Banal internet user BMJ's Avatar
    Join Date
    Aug 2002
    Location
    Chicagoland
    Posts
    1,380
    yes, but cout (console output) and cin (console input) are more standard C++

  6. #6
    Registered User shuesty's Avatar
    Join Date
    Oct 2002
    Posts
    21
    What can I say I'm a die hard c fan ... that and it's all that's been pounded into my head at university so far. Also I'm working with VC++ .Net and I've gotten it to work. But I can appreciate the importance of cin and cout.

  7. #7
    BMJ
    BMJ is offline
    Banal internet user BMJ's Avatar
    Join Date
    Aug 2002
    Location
    Chicagoland
    Posts
    1,380
    Originally posted by shuesty
    What can I say I'm a die hard c fan ... that and it's all that's been pounded into my head at university so far. Also I'm working with VC++ .Net and I've gotten it to work. But I can appreciate the importance of cin and cout.
    Well anything that works in C also works in C++

  8. #8
    Registered User
    Join Date
    Oct 2002
    Posts
    2

    Unhappy

    Appreciate the responces...but. Here's the scenario

    I need to capture a certain portion of a terminal window, save it, and then restore it. Saving? into a dynamically allocated array, how? simple, i just the functions!!!!!
    Code:
    //here's some clarification
    }
    char *buffer;
    
    #if PLATFORM == AIX //unix
    	buffer = (char *)malloc(height * width);
    
    	for (i = 0; i < height; i++)
    	    for (j = 0; j < width; j++)
    		buffer[idx++] = mvinch(row + i, col + j);
    #elif PLATFORM == BC //borland
    
    	buffer = (char *)malloc(height * width * 2);
    	gettext(col + 1, row + 1, col + width, row + height, buffer);
    
    #elif PLATFORM == VC //visual c++
    		/*THIS IS WHAT I NEED*/
    #endif
    }
    &#91;code]&#91;/code]tagged by Salem

  9. #9
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >I need to capture a certain portion of a terminal window, save it, and then restore it.
    When you write to the screen, save all of the data to a buffer and write the buffer to the screen. Then you have the buffer which can be used later.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 06-16-2009, 06:37 AM
  2. moving functions into visual compilers
    By pastitprogram in forum C++ Programming
    Replies: 4
    Last Post: 09-03-2008, 07:37 AM
  3. Visual C++ 2005 linking and file sizes
    By Rune Hunter in forum C++ Programming
    Replies: 2
    Last Post: 11-12-2005, 10:41 PM
  4. question about .net to 6.0 change causing errors
    By jverkoey in forum C++ Programming
    Replies: 17
    Last Post: 03-23-2004, 10:45 AM
  5. header file bringing errors?
    By bluehead in forum Windows Programming
    Replies: 4
    Last Post: 08-19-2003, 01:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21