Thread: Redirecting console output

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    2

    Redirecting console output

    Is there any way I can redirect the output of a console program, so that it's not printed to the command line interpreter, but for instance to a file? I would like to write my own pseudo-command line interpreter - that is have windows run all the commands but display the output in my own program. Is this possible without assembler?

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Check out the following article:
    http://support.microsoft.com/kb/q190351/

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    stdout: >
    stdin: <
    stderr: ?>

    so to redirect the standard input from the keyboard to a file called input.txt, redirect the output from the screen to a file called output.txt, and redirect the error from the screen to a file called error.txt using a program called foo.exe you would have:
    Code:
    foo.exe < input.txt >output.txt ?>error.txt

  4. #4
    Registered User
    Join Date
    Nov 2004
    Posts
    2
    Thanks both of you. I'll check that out.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help editing console output
    By Longbow0705 in forum C++ Programming
    Replies: 6
    Last Post: 03-27-2009, 08:57 AM
  2. Text Justification for console output
    By greywolf0723 in forum C++ Programming
    Replies: 1
    Last Post: 03-10-2009, 12:29 AM
  3. Having trouble making a function do what I want.
    By Shamino in forum C++ Programming
    Replies: 9
    Last Post: 12-07-2007, 11:20 AM
  4. Code doesn't output to console
    By smitsky in forum C++ Programming
    Replies: 5
    Last Post: 10-03-2004, 08:41 AM
  5. help with redirecting std output & errors
    By fergie in forum Linux Programming
    Replies: 3
    Last Post: 04-22-2002, 02:59 PM