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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CString

CString

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 2 Posters 0 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.
  • L Offline
    L Offline
    Laing James
    wrote on last edited by
    #1

    Hello. Is there a way to read the (stdout) output from another application directly into a CString? ie) when I specify my application in a series of piped command-line apps, what is the best way to read from stdin, so that I can read data directly into a CString rather than have to worry about the length of the lines of input data? Thanks in advance. James.

    J 1 Reply Last reply
    0
    • L Laing James

      Hello. Is there a way to read the (stdout) output from another application directly into a CString? ie) when I specify my application in a series of piped command-line apps, what is the best way to read from stdin, so that I can read data directly into a CString rather than have to worry about the length of the lines of input data? Thanks in advance. James.

      J Offline
      J Offline
      James R Twine
      wrote on last edited by
      #2

      I do not know if you can do that using stdin without using a intermediate buffer of some kind.    You can always continue to read stdin in chunks, like reading it into a 1KB buffer and appending the buffer to the CString, until you hit the end of the output data (EOF).    There may be a way to do it using the C++ stream classes and std::string, but I am not certain if you will not still have to use some intermediate transfer mechanism.    Peace!

      -=- James
      Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
      Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
      See DeleteFXPFiles

      L 1 Reply Last reply
      0
      • J James R Twine

        I do not know if you can do that using stdin without using a intermediate buffer of some kind.    You can always continue to read stdin in chunks, like reading it into a 1KB buffer and appending the buffer to the CString, until you hit the end of the output data (EOF).    There may be a way to do it using the C++ stream classes and std::string, but I am not certain if you will not still have to use some intermediate transfer mechanism.    Peace!

        -=- James
        Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
        Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
        See DeleteFXPFiles

        L Offline
        L Offline
        Laing James
        wrote on last edited by
        #3

        Thanks for the reply. I have ended up using a 'string' class object to read into from cin and getting a const char pointer to it, so that I can get the data into a CString. What a mess, but it works. Thanks. James.

        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