Reading a character from the screen

This is a discussion on Reading a character from the screen within the C++ Programming forums, part of the General Programming Boards category; Is there a function I can use to read in a character from the screen? This would be on regular ...

  1. #1
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640

    Reading a character from the screen

    Is there a function I can use to read in a character from the screen? This would be on regular DOS mode. (Not console). Would it be easier to use assembler blocks to read in a character? My ultimate goal is to read in an array of characters into a var[]. This way I can write over current text and then replace it.
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Um, I may be misunderstanding your question, but is ths what you want?
    Code:
    #include <iostream> 
    using namespace std;
    
    int main ( void ) 
    { 
      char c;
      cin.get ( c );
      while ( c != '\n' ) {
        cout.put ( c );
        cin.get ( c );
      }
      cout<<endl;
      return EXIT_SUCCESS; 
    }
    -Prelude
    My best code is written with the delete key.

  3. #3
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    No, I know how to get keyboard input, but I want to be able to (in 80x25 screen) be able to pick a coordinate and then find what text is at that location. Like if I just printed a text file to the screen and I want to find what character is on the screen at location 14,20.
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  4. #4
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Put what u posted in a 2d array and then get it from there. Would that work in this case??

  5. #5
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    The only way I can think of involves asm.

    You would need to loop through the screen buffer while storing every other byte in an array starting with the first character byte. Not too complicated really, but my materials are at home. If you have the resources, try to figure it out...

    B800



    I think...

    it has been a couple of years

    edit***
    http://www.ee.vt.edu/~pushkin/ecpe4536/lec6.html

    look here under more output in text modes
    Last edited by Betazep; 03-03-2002 at 04:12 PM.
    Blue

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 11
    Last Post: 10-07-2008, 06:19 PM
  2. Problem in reading Character
    By Bargi in forum C Programming
    Replies: 5
    Last Post: 04-10-2008, 11:40 PM
  3. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 03:56 PM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  5. syntax error when defining vectors
    By starkhorn in forum C++ Programming
    Replies: 5
    Last Post: 09-22-2004, 12:46 PM

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