This is the mail archive of the gcc-bugs@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]

Re: Small bug in STL - 2.95.2


> 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

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