bug-gplusplus
[Top][All Lists]
Advanced

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

string template the 2nd


From: FISCHBACHER Markus
Subject: string template the 2nd
Date: Thu, 30 Nov 2000 18:01:38 +0100

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.

int main(int argc, char* argv[])
{
        string str;
        
        str = "0123456789";
        str.erase(0, 5);

        cout << str                     << endl;        // Output -> 56789
        cout << str.data()      << endl;        // Output -> 5678956789

        return 0;
}

i mean the error must be in the replace function from basic_string,
because erase uses the replace function.
the error can also be a few steps lower in the code.
it seems the string doesn`t set the null-terminator correctly.

has anybody also recognized this error?
is a patch available?

thx for info

markus

my system:
UNIXWare 7.1.1
GCC 2.95.2pl1

<<application/ms-tnef>>


reply via email to

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