bug-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string template the 2nd


From: Kriang Lerdsuwanakij
Subject: Re: string template the 2nd
Date: Thu, 30 Nov 2000 23:00:52 -0800

FISCHBACHER Markus wrote:

> hi again!
>
> now i have got an example where the error occurs.
>
> when i give out the string "str" with cout, the output is correct.
> the output of "str.data()" with cout is incorrect.

str.data() return a char* that may or may not be null-terminated.
So the behavior of the program you posted is correct.   To get a
null-terminated string, use str.c_str() instead.

--Kriang





reply via email to

[Prev in Thread] Current Thread [Next in Thread]