www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/29/16:26:47

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: strstream str() problem
Date: Thu, 29 Oct 1998 13:05:46 -0800
Organization: Alcyone Systems
Lines: 23
Message-ID: <3638D8AA.2D43A06@alcyone.com>
References: <C12566A9 DOT 00333F43 DOT 00 AT hurricane DOT xircom DOT com>
NNTP-Posting-Host: charmaine.alcyone.com
Mime-Version: 1.0
X-Mailer: Mozilla 3.01 (X11; I; Linux 2.0.34 i686)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Koen_Van_Herck AT xircom DOT com wrote:

> The following code
	...
> fails to properly terminate the string s. (output is "test
> first\ngarbagegarbage...test\ngarbage..." It seems the str() function
> does
> not append the '\0' terminator to the string correctly. Is this a bug,
> or
> am I doing something wrong ?

You need to terminate it yourself, with

    os << ends;

-- 
Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900 
Alcyone Systems / irc maxxon (efnet) / finger max AT sade DOT alcyone DOT com
  San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/
          USA / icbm 37 20 07 N 121 53 38 W / &tSftDotIotE
             \
            / The believer is happy; the doubter is wise.
           / (an Hungarian proverb)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019