CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2001
    Posts
    153

    Capturing stdout, stderr into a string

    Sorry, made an error in the title, hence posting again.

    Hi Gurus,

    I want to capture the stdout/stderr from a system() command into a string. How would I do this? I know I can capture into a file, but how into a string? Do I have to capture in a file, and then read the file? That sucks!

    Kamran

    P.S. Only portable solutions please (no MFCs)

  2. #2
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,020
    You could try popen instead of system. This will put the output straight into a pipe which you can read directly. On Unix, it is popen, on Windows, it is _popen.

    Are you using an OS that supports pipes?
    Succinct is verbose for terse

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