mirror of git://gcc.gnu.org/git/gcc.git
re PR libstdc++/6648 (Problems with cin.getline (interactive))
2002-05-15 Paolo Carlini <pcarlini@unitus.it> PR libstdc++/6648 * include/bits/istream.tcc (istream::getline, ignore): Upon __idelim (__delim) call sbumpc() not snextc(). * testsuite/27_io/narrow_stream_objects.cc: Add test08 and test09. From-SVN: r53481
This commit is contained in:
parent
194734e9e5
commit
bf6f276b01
|
|
@ -1,3 +1,11 @@
|
||||||
|
2002-05-15 Paolo Carlini <pcarlini@unitus.it>
|
||||||
|
|
||||||
|
PR libstdc++/6648
|
||||||
|
* include/bits/istream.tcc (istream::getline, ignore):
|
||||||
|
Upon __idelim (__delim) call sbumpc() not snextc().
|
||||||
|
* testsuite/27_io/narrow_stream_objects.cc:
|
||||||
|
Add test08 and test09.
|
||||||
|
|
||||||
2002-05-13 Benjamin Kosnik <bkoz@redhat.com>
|
2002-05-13 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
* testsuite/22_locale/ctype_scan_char.cc: Tweak.
|
* testsuite/22_locale/ctype_scan_char.cc: Tweak.
|
||||||
|
|
|
||||||
|
|
@ -679,7 +679,7 @@ namespace std
|
||||||
{
|
{
|
||||||
if (__c == __idelim)
|
if (__c == __idelim)
|
||||||
{
|
{
|
||||||
__sb->snextc();
|
__sb->sbumpc();
|
||||||
++_M_gcount;
|
++_M_gcount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -726,7 +726,7 @@ namespace std
|
||||||
this->setstate(ios_base::eofbit);
|
this->setstate(ios_base::eofbit);
|
||||||
else if (__c == __delim)
|
else if (__c == __delim)
|
||||||
{
|
{
|
||||||
__sb->snextc();
|
__sb->sbumpc();
|
||||||
++_M_gcount;
|
++_M_gcount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,23 @@ void test07()
|
||||||
VERIFY( s == "test" );
|
VERIFY( s == "test" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// libstdc++/6648
|
||||||
|
// Interactive tests: each one (run alone) must terminate upon a single '\n'.
|
||||||
|
void test08()
|
||||||
|
{
|
||||||
|
bool test = true;
|
||||||
|
char buff[2048];
|
||||||
|
std::cout << "Enter name: ";
|
||||||
|
std::cin.getline(buff, 2048);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test09()
|
||||||
|
{
|
||||||
|
bool test = true;
|
||||||
|
std::cout << "Enter name: ";
|
||||||
|
std::cin.ignore(2048, '\n');
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
|
@ -186,5 +203,7 @@ main()
|
||||||
// test05();
|
// test05();
|
||||||
// test06();
|
// test06();
|
||||||
// test07();
|
// test07();
|
||||||
|
// test08();
|
||||||
|
// test09();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue