CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2005
    Posts
    46

    Capture console output in real-time. Help!

    Hello

    I am building a Windows application that, at some point, calls a separate process (a command line application). The latter takes quite some time to complete (about 5 minutes or more). How can I capture the console app's output in order to show it (in a textbox for instance) in my windows application?

    Please note that I don't want the console app's whole output after it's completed. I want to capture its console output while it's producing it.

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Capture console output in real-time. Help!

    You can use the old DOS > text.txt to send output to a file.
    It's called the pipe character. >> appends, while > creates.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Mar 2006
    Location
    Craiova, Romania
    Posts
    439

    Re: Capture console output in real-time. Help!

    See if Process.StandardOutput helps you:
    http://msdn2.microsoft.com/en-us/lib...ardoutput.aspx
    Bogdan

    If someone helped you then please Rate his post and mark the thread as Resolved
    Please improve your messages appearance by using tags [ code] Place your code here [ /code]

  4. #4
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: Capture console output in real-time. Help!

    Take a look at BeginOutputReadLine Method of the process class.
    Last edited by Shuja Ali; July 1st, 2007 at 03:58 AM. Reason: Corrected the URL Tag

  5. #5
    Join Date
    Apr 2005
    Posts
    46

    Re: Capture console output in real-time. Help!

    Quote Originally Posted by creatorul
    See if Process.StandardOutput helps you:
    http://msdn2.microsoft.com/en-us/lib...ardoutput.aspx
    Quote Originally Posted by Shuja Ali
    Take a look at BeginOutputReadLine Method of the process class.
    Thanks guys, I haven't tried it yet but I'm pretty sure this is what I've been looking for. You were of great help.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured