Redirecting console output

This is a discussion on Redirecting console output within the Windows Programming forums, part of the Platform Specific Boards category; Is there any way I can redirect the output of a console program, so that it's not printed to the ...

  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,265
    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, 09:57 AM
  2. Text Justification for console output
    By greywolf0723 in forum C++ Programming
    Replies: 1
    Last Post: 03-10-2009, 01: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, 09:41 AM
  5. help with redirecting std output & errors
    By fergie in forum Linux Programming
    Replies: 3
    Last Post: 04-22-2002, 03:59 PM

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