Click here to Skip to main content
16,007,885 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC Document/View - New Milestone :: C++ Pin
valikac22-Feb-02 10:10
valikac22-Feb-02 10:10 
GeneralRe: MFC Document/View - New Milestone :: C++ Pin
22-Feb-02 2:59
suss22-Feb-02 2:59 
Generalfile - streams... Pin
Bernhard21-Feb-02 19:55
Bernhard21-Feb-02 19:55 
GeneralRe: file - streams... Pin
Joaquín M López Muñoz21-Feb-02 20:16
Joaquín M López Muñoz21-Feb-02 20:16 
GeneralRe: file - streams... Pin
Bernhard21-Feb-02 20:38
Bernhard21-Feb-02 20:38 
GeneralRe: file - streams... Pin
Joaquín M López Muñoz21-Feb-02 22:45
Joaquín M López Muñoz21-Feb-02 22:45 
GeneralRe: file - streams... Pin
Bernhard22-Feb-02 0:06
Bernhard22-Feb-02 0:06 
GeneralRe: file - streams... Pin
22-Feb-02 9:18
suss22-Feb-02 9:18 
enclosed an article of Microsoft, source of this statement:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q240015

Krz


FIX: getline Template Function Reads Extra Character (Q240015)

-------------------------------------------------------------------------
The information in this article applies to:

The Standard C++ Library, used with:
Microsoft Visual C++, 32-bit Enterprise Edition, version 6.0
Microsoft Visual C++, 32-bit Professional Edition, version 6.0
Microsoft Visual C++, 32-bit Learning Edition, version 6.0

-------------------------------------------------------------------------


SYMPTOMS
The Standard C++ Library template getline function reads an extra character after encountering the delimiter. Please refer to the sample program in the More Information section for details.


RESOLUTION
Modify the getline member function, which can be found in the following system header file string, as follows:

else if (_Tr::eq((_E)_C, _D))
{_Chg = true;
// _I.rdbuf()->snextc(); /* Remove this line and add the line below.*/
_I.rdbuf()->sbumpc();
break; }

NOTE : Because the resolution involves modifying a system header file, extreme care should be taken to ensure that nothing else is changed in the header file. Microsoft is not responsible for any problems resulting from unwanted changes to the system header files.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

This problem was corrected in Microsoft Visual C++ .NET.


MORE INFORMATION
The following sample program demonstrates the bug:

//test.cpp
//Compiler options : /GX
#include <string>
#include <iostream>
int main () {
std::string s,s2;
std::getline(std::cin,s);
std::getline(std::cin,s2);
std::cout << s <<'\t'<< s2 << std::endl;
return 0;
}

Actual Results:
Hello<enter key="">
World<enter key="">
<enter key="">
Hello World

Expected Results:
Hello<enter key="">
World<enter key="">
Hello World


-------------------------------------------------------------------------
Published Sep 16 1999 12:33PM Issue Type kbbug
Last Modifed Feb 11 2002 7:06PM Additional Query Words STL
Keywords kbtemplate kbLangCPP kbSTL kbVC kbVC600 kbVC600bug kbNoUpdate
General2D Color Gradient or Ramp Pin
Paul Selormey21-Feb-02 17:50
Paul Selormey21-Feb-02 17:50 
GeneralRe: 2D Color Gradient or Ramp Pin
Christian Graus21-Feb-02 18:16
protectorChristian Graus21-Feb-02 18:16 
GeneralRe: 2D Color Gradient or Ramp Pin
Paul Selormey23-Feb-02 19:50
Paul Selormey23-Feb-02 19:50 
GeneralMemory DC to CBitmap object Pin
Wolfram Steinke21-Feb-02 17:33
Wolfram Steinke21-Feb-02 17:33 
GeneralRe: Memory DC to CBitmap object Pin
Christian Graus21-Feb-02 18:19
protectorChristian Graus21-Feb-02 18:19 
Generalquestion about LNK2005 and LINK1169 Pin
RK_200021-Feb-02 11:52
RK_200021-Feb-02 11:52 
GeneralRe: question about LNK2005 and LINK1169 Pin
Michael Dunn21-Feb-02 12:11
sitebuilderMichael Dunn21-Feb-02 12:11 
GeneralThis BSTR** business is dirty!!! Pin
Nish Nishant21-Feb-02 11:50
sitebuilderNish Nishant21-Feb-02 11:50 
GeneralRe: This BSTR** business is dirty!!! Pin
Derek Waters21-Feb-02 11:51
Derek Waters21-Feb-02 11:51 
GeneralRe: This BSTR** business is dirty!!! Pin
Nish Nishant21-Feb-02 12:04
sitebuilderNish Nishant21-Feb-02 12:04 
GeneralUnbelievable error when attempting to return a BSTR** as retval Pin
Nish Nishant21-Feb-02 11:39
sitebuilderNish Nishant21-Feb-02 11:39 
GeneralRe: Unbelievable error when attempting to return a BSTR** as retval Pin
Felix Cho21-Feb-02 11:54
Felix Cho21-Feb-02 11:54 
GeneralRe: Unbelievable error when attempting to return a BSTR** as retval Pin
Derek Waters21-Feb-02 11:50
Derek Waters21-Feb-02 11:50 
GeneralRe: Unbelievable error when attempting to return a BSTR** as retval Pin
Felix Cho21-Feb-02 11:55
Felix Cho21-Feb-02 11:55 
GeneralRe: Unbelievable error when attempting to return a BSTR** as retval Pin
Nish Nishant21-Feb-02 12:01
sitebuilderNish Nishant21-Feb-02 12:01 
GeneralRe: Unbelievable error when attempting to return a BSTR** as retval Pin
Nish Nishant21-Feb-02 12:02
sitebuilderNish Nishant21-Feb-02 12:02 
GeneralRe: Unbelievable error when attempting to return a BSTR** as retval Pin
Felix Cho21-Feb-02 16:39
Felix Cho21-Feb-02 16:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.