Thread: Recording console window output to a text file?

  1. #1
    Registered User
    Join Date
    Feb 2002

    Wink Recording console window output to a text file?

    I have a question about recording the output of a C++ win32 console application.

    I'm using visual C++ and would like to know if there is a simple or standard way to record everything your program outputs in the console into a text file?

    Will I need to write functions to do the file handling, or is there already built in capability, or any existing code out there for handling this exact purpose?

  2. #2
    Registered User
    Join Date
    Jan 2002
    "c:\myprog.exe > c:\textfile.txt" w/o quotes

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Open an output file, and mirror what you output to the screen with the same thing that outputs to the file:
    cout<< someVar <<"Text"<<endl;
    FOUT<< someVar <<"Text"<<endl;

    That's the easiest way, not elegant by any means but it works.

    My best code is written with the delete key.

  4. #4
    Registered User
    Join Date
    Feb 2002
    Thanks, thats just what I needed.

    Originally posted by Brian
    "c:\myprog.exe > c:\textfile.txt" w/o quotes

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 08:14 AM
  2. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  3. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM
  4. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 07:35 PM
  5. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 04:08 PM