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

    [C++] get results of console

    I have a Win32 app and with that app i'm going to open another .exe file. That other .exe file is a console app and it will write some data to that console. Now i was wondering if there's anyway my win32 app can read the output of that console..??

  2. #2
    Join Date
    Aug 2008
    Posts
    902

    Re: [C++] get results of console

    The calling app should be able to receive the return value of the other program. But this of course is only a integer value. In Unix, one console application can take another application as a parameter and pipe it's output into that program.

  3. #3
    Join Date
    Oct 2002
    Location
    Austria
    Posts
    1,284

    Re: [C++] get results of console

    I'd redirect the output of that console program to a file ( via myexe.exe > "out.txt" ).
    Your Gui App could then read that file.
    Kurt

  4. #4
    Join Date
    Nov 2005
    Posts
    102

    Re: [C++] get results of console

    Quote Originally Posted by Chris_F View Post
    The calling app should be able to receive the return value of the other program. But this of course is only a integer value. In Unix, one console application can take another application as a parameter and pipe it's output into that program.
    So with other words, it's not really possible in Windows to get the entire output pf a console window?? Eventhough my app is the one opening that console app...?

  5. #5
    Join Date
    Aug 2008
    Posts
    902

    Re: [C++] get results of console

    Well, you can either output the console to a temporary file, or you can use pipes.

  6. #6
    Join Date
    Feb 2002
    Posts
    4,640

    Re: [C++] get results of console

    Here's an example of redirecting stdin, stdout, and stderr using CreateProcess and pipes.

    Viggy

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