CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009

    redirect to file

    I have a console application that when runs i like to capture its console output and send to a file. any line as console gets updated should get appended to file. Any sample code or piece of working code?.

  2. #2
    Join Date
    Apr 2009

    Re: redirect to file

    If your command line looks like
    prg_one.exe | prg_two.exe
    Then, in prg_two.exe, you can read output data from prg_one.exe, with statements about files (fopen, fread, fclose if you progream in C), but with stdin instead of the name of a file when you open your file. But it more simple to write
    prg_one.exe >somefile.txt
    Or if your operating system is Unix, you might like to use tail -f
    Last edited by olivthill2; December 3rd, 2009 at 08:33 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.