The getline function in Microsoft Visual C++ 6.0 is broken. The fix is to edit your string.h file (fix to follow). How a somewhat major error such as this managed to make it into the final version is beyond me. Anyway the function reads one character past the end line '\n'; and therefore screws up everything, unless you use a system of double inputs and cin.ignore()s. It is also a bug which Microsoft has documented well, but has not provided an automatic patch for.

Instructions for fixing as provided by MS KB article: Q240015

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.

Log in or register to write something here or to contact authors.