home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12520 < prev    next >
Encoding:
Text File  |  1992-08-18  |  1.0 KB  |  39 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!stanford.edu!lucid.com!lucid.com!jss
  3. From: jss@lucid.com (Jerry Schwarz)
  4. Subject: Re: strstream question
  5. Message-ID: <1992Aug18.211841.25068@lucid.com>
  6. Sender: usenet@lucid.com
  7. Reply-To: jss@lucid.com (Jerry Schwarz)
  8. Organization: Lucid, Inc.
  9. References:  <1992Aug18.142928.14515@walter.bellcore.com>
  10. Date: Tue, 18 Aug 92 21:18:41 GMT
  11. Lines: 26
  12.  
  13. In article <1992Aug18.142928.14515@walter.bellcore.com>, vidal@bae.bellcore.com (Vidal Graupera) writes:
  14. |> I want to change the string in an existing strstream. 
  15. |> This is what I tried on a Sun using their 2.1 compiler:
  16. |> 
  17. |>   char p[100];
  18. |>   ostrstream tstream(p, 100);
  19. |> 
  20. |>   // do some stuff with tstream
  21. |> 
  22. |>   char t[100];
  23. |>   tstream.rdbuf()->setbuf(t,100);
  24. |> 
  25. |>   // tstream still uses p NOT t
  26. |> 
  27.  
  28. Can't be done.  Setbuf is effective on strstreams only 
  29. if you've used the default constructor and you haven't
  30. inserted anything into the strstream.   If you check the
  31. return from setbuf you'll see it was NULL.  
  32.  
  33.    -- Jerry Schwarz
  34.  
  35.  
  36.  
  37.  
  38.  
  39.