This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
AW: Strings and Integers?
- To: oliva at dcc dot unicamp dot br, oe dot hansen at oehansen dot pp dot se
- Subject: AW: Strings and Integers?
- From: Dietmar dot Kuehl at asa dot iZB-Soft dot de
- Date: Mon, 1 Dec 1997 16:37:00 +0100
- Cc: egcs at cygnus dot com
Hi,
>
> I find <string> close to unusable :-) The reason, is that it appears
>implemented as "pascal strings"...
This is probably because you haven't closely paid attention to the
documentation
(like eg. found in the DWP):
> cout.form(" => %8.2f (%d:%s)", v, str.length(), str.data()) << endl;
'data()' is indeed defined to return the internal representation,
potentially without a
terminating '\0'! Use 'c_str()' if you want a '\0' terninated
representation.