Small bug in STL - 2.95.2
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Thu Feb 24 02:33:00 GMT 2000
> I am using gcc version 2.95.2 and had the following problem:
> In std/bastring.cc - function getline - there is no
> end-of-string appended to the string.
> Thus the string is not terminated.
Thanks for your bug report. I cannot reproduce the problem, the program
#include <iostream>
#include <string>
#include <stdio.h>
int main()
{
string x;
getline(cin,x);
printf("%s\n",x.c_str());
}
works fine for me. There is no need to add a string delimiter ('\0')
to the basic_string, as the string template keeps track of the string
length separately.
If you see something different, please make a full bug report, as
requested in
http://www.gnu.org/software/gcc/bugs.html
Thanks,
Martin
More information about the Gcc-bugs
mailing list