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. unwanted character on stringstream

unwanted character on stringstream

Scheduled Pinned Locked Moved C / C++ / MFC
c++linuxhelp
4 Posts 3 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.
  • G Offline
    G Offline
    gecool
    wrote on last edited by
    #1

    Hello everyone. I know it is a message board for VC++, but I haven't found one for "plain" C++ here (under linux, i.e.). The following code sequence produces an "A" on stdout, and I cannot figure it out why. PLEASE help ! stringstream os; string buf; os.str(""); buf=os.str(); cout << buf << flush;

    T E 2 Replies Last reply
    0
    • G gecool

      Hello everyone. I know it is a message board for VC++, but I haven't found one for "plain" C++ here (under linux, i.e.). The following code sequence produces an "A" on stdout, and I cannot figure it out why. PLEASE help ! stringstream os; string buf; os.str(""); buf=os.str(); cout << buf << flush;

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      why do you pass thru a StringStream ? couldn't you just do :

      cout << string("") << flush;

      or at least :

      String buf = "";
      cout << but << flush;

      what happens if you move the flush outside the line ? (calling cout.flush() after)...?


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      G 1 Reply Last reply
      0
      • G gecool

        Hello everyone. I know it is a message board for VC++, but I haven't found one for "plain" C++ here (under linux, i.e.). The following code sequence produces an "A" on stdout, and I cannot figure it out why. PLEASE help ! stringstream os; string buf; os.str(""); buf=os.str(); cout << buf << flush;

        E Offline
        E Offline
        Eytukan
        wrote on last edited by
        #3

        gecool wrote: but I haven't found one for "plain" C++ here Click Here.. http://www.codeproject.com/script/comments/forums.asp?forumid=3785&df=100[^] Regards, V

        1 Reply Last reply
        0
        • T toxcct

          why do you pass thru a StringStream ? couldn't you just do :

          cout << string("") << flush;

          or at least :

          String buf = "";
          cout << but << flush;

          what happens if you move the flush outside the line ? (calling cout.flush() after)...?


          TOXCCT >>> GEII power
          [toxcct][VisualCalc]

          G Offline
          G Offline
          gecool
          wrote on last edited by
          #4

          The whole idea is that I know how to output an empty string ;-), but in a piece of code where I am using streams, that unwanted character "A", keep showing up grrrrrr, and I would like to figure out why. If I remove the flush, same thing happens.

          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