AW: Strings and Integers?

Dietmar.Kuehl@asa.iZB-Soft.de Dietmar.Kuehl@asa.iZB-Soft.de
Mon Dec 1 07:38:00 GMT 1997


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.



More information about the Gcc mailing list