This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

AW: Strings and Integers?


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]