| www.delorie.com/archives/browse.cgi | search |
| From: | "D. Vrabel" <dv207 AT hermes DOT cam DOT ac DOT uk> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: strstream str() problem |
| Date: | Mon, 26 Oct 1998 15:33:08 +0000 |
| Organization: | University of Cambridge, England |
| Lines: | 14 |
| Message-ID: | <Pine.HPP.3.96L.981026152958.10507C-100000@punch.eng.cam.ac.uk> |
| References: | <C12566A9 DOT 00333F43 DOT 00 AT hurricane DOT xircom DOT com> |
| NNTP-Posting-Host: | punch.eng.cam.ac.uk |
| Mime-Version: | 1.0 |
| X-Sender: | dv207 AT punch DOT eng DOT cam DOT ac DOT uk |
| In-Reply-To: | <C12566A9.00333F43.00@hurricane.xircom.com> |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
On Mon, 26 Oct 1998 Koen_Van_Herck AT xircom DOT com wrote:
> It seems the str() function [in strstream] does
> not append the '\0' terminator to the string correctly. Is this a bug, or
> am I doing something wrong ?
The behavior you are experiencing is the correct one.
You must terminate your strings with the ends manipulator
eg:
strstream s;
s << "Testing, testing" << ends;
string str=s.str();
Dave.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |