Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. reading stdout

reading stdout

Scheduled Pinned Locked Moved C / C++ / MFC
debuggingc++comhelpquestion
7 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chris Losinger
    wrote on last edited by
    #1

    i have a library, which i can not modify. this library is called from a console app, and as part of its processing, this library dumps a large and variable amount of debug/trace info to stdout. i'd like to be able to read what the library is sending to stdout from the calling code, in order to extract certain pieces of info for analysis. basically, i want to capture some of what the library prints during a call, save that info away until the call completes, then re-print the info in a better format. this would help me from having to search the hundreds of lines of output to find the particular bits i need. (this is Windows, C++) is such a thing possible?

    image processing toolkits | batch image processing

    A L 2 Replies Last reply
    0
    • C Chris Losinger

      i have a library, which i can not modify. this library is called from a console app, and as part of its processing, this library dumps a large and variable amount of debug/trace info to stdout. i'd like to be able to read what the library is sending to stdout from the calling code, in order to extract certain pieces of info for analysis. basically, i want to capture some of what the library prints during a call, save that info away until the call completes, then re-print the info in a better format. this would help me from having to search the hundreds of lines of output to find the particular bits i need. (this is Windows, C++) is such a thing possible?

      image processing toolkits | batch image processing

      A Offline
      A Offline
      Albert Holguin
      wrote on last edited by
      #2

      Have you tried redirection operators[^]?

      C 1 Reply Last reply
      0
      • A Albert Holguin

        Have you tried redirection operators[^]?

        C Offline
        C Offline
        Chris Losinger
        wrote on last edited by
        #3

        i need to do this within the calling app, not from the shell.

        image processing toolkits | batch image processing

        A 1 Reply Last reply
        0
        • C Chris Losinger

          i need to do this within the calling app, not from the shell.

          image processing toolkits | batch image processing

          A Offline
          A Offline
          Albert Holguin
          wrote on last edited by
          #4

          Do you need this for trouble-shooting or all the time? ...because it sounded like you just needed for troubleshooting, in which case... why not use the shell options? ..but otherwise, you can always try reassigning the stream using freopen[^]. Here's an actual example... http://support.microsoft.com/kb/58667[^]

          C 1 Reply Last reply
          0
          • A Albert Holguin

            Do you need this for trouble-shooting or all the time? ...because it sounded like you just needed for troubleshooting, in which case... why not use the shell options? ..but otherwise, you can always try reassigning the stream using freopen[^]. Here's an actual example... http://support.microsoft.com/kb/58667[^]

            C Offline
            C Offline
            Chris Losinger
            wrote on last edited by
            #5

            Albert Holguin wrote:

            Do you need this for trouble-shooting or all the time

            all the time.

            image processing toolkits | batch image processing

            A 1 Reply Last reply
            0
            • C Chris Losinger

              Albert Holguin wrote:

              Do you need this for trouble-shooting or all the time

              all the time.

              image processing toolkits | batch image processing

              A Offline
              A Offline
              Albert Holguin
              wrote on last edited by
              #6

              Ok, try out the freopen option... hopefully that gets the job done.

              1 Reply Last reply
              0
              • C Chris Losinger

                i have a library, which i can not modify. this library is called from a console app, and as part of its processing, this library dumps a large and variable amount of debug/trace info to stdout. i'd like to be able to read what the library is sending to stdout from the calling code, in order to extract certain pieces of info for analysis. basically, i want to capture some of what the library prints during a call, save that info away until the call completes, then re-print the info in a better format. this would help me from having to search the hundreds of lines of output to find the particular bits i need. (this is Windows, C++) is such a thing possible?

                image processing toolkits | batch image processing

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Hey Chris, Creating a Child Process with Redirected Input and Output[^] If you don't get any redirected output from the sample above... then your third-party console app might be writing to the STD_ERROR_HANDLE rather than the STD_OUTPUT_HANDLE. GetStdHandle function[^]. Best Wishes, -David Delaune

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups