Thread: Reading from the screen

  1. #1
    Registered User
    Join Date
    Jan 2002

    Question Reading from the screen

    How would you read in text that is displayed in the current window?
    You evoke the command "Dir C:\" using system in stdlib.h.
    How would you read in all the stuff, that the OS spits back at you?

    If the answer is really obvious, its because I'm really new at this.

  2. #2
    Registered User
    Join Date
    Dec 2001
    system( "dir C:\\ > output.txt" );
    Now you can open the file "output.txt" which will contain all the info displayed on the screen from the call to dir

    In Dos/Win console mode you can redirect input or output using > and <

    program < input.txt > output.txt

    That would run program and instead of using the keyboard for cin, it would use input.txt for cin. and instead of displaying to the screen, it would print to the file output.txt

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading pixel color data from screen
    By JJFMJR in forum Windows Programming
    Replies: 8
    Last Post: 08-22-2008, 12:27 PM
  2. console screen (Windows)
    By hakan in forum C++ Programming
    Replies: 1
    Last Post: 03-12-2008, 06:35 AM
  3. Render text
    By Livijn in forum C++ Programming
    Replies: 6
    Last Post: 07-06-2007, 03:32 PM
  4. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  5. Converting from Screen to World Coordinates
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 05-11-2004, 12:51 PM