Visual C++ 6.0 getline() Fixer
 

Introduction:

Visual C++ 6.0 has a documented bug in its getline() routine, which is defined in the "STRING" include file. Microsoft has documented this bug and prescribed a fix, which can be read at

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

The "getline() Fixer" utility has been created to perform this fix for you, which involves modifying a system header file.

 

The Problem:

The bug causes getline() to work incorrectly when reading input from the keyboard. Specifically, the user is required to strike the Enter key multiple times instead of once after entering a line of input.

Consider the following sample program that prompts the user for 5 lines of input, reads each line with getline()and echoes them to the screen. (The imaginative user has typed "This is line 0", "This is line 1", etc. at each prompt.) At the end, the program prints "That's all folks!" on a separate line. If getline()is working properly, the program produces the following output:

When using the "buggy" version of getline()provided with Visual C++ 6.0, the same program produces the following output:

To check whether you need to repair your version of getline(), try creating a Visual C++ project and running the on your own machine. If the program does not produce the desired output, you need to repair getline().

 

What this Utility Does:

In order to fix the bug, the "getline() Fixer" utility does the following:

  1. locates the appropriate system header
  2. ensures that the header has not already been modified
  3. modifies the header as recommended
  4. provides a copy of the original header for your archives.

This utility has been tested and debugged. Before proceeding further, you should be aware of the following concerns:

  1. You should not run an executable file on your computer if you do not know and trust the source of that file.
  2. You should not run this utility unless you are certain it is an unaltered original file obtained from the following URL:
  3. If you have obtained a copy of this utility from some other source, there is no guarantee it is unaltered, and you should not use it.
  4. If you are uncertain about whether to use this utility, you should exit this program now and follow directions given at the Microsoft site for fixing the getline bug.
 

What You Need to Do:

  • Create a Visual C++ project and run the sample program to determine whether you need to fix getline() on your machine.
  • Download the utility to your own machine and unzip it. If you have a "normal installation" of Visual C++ (i.e., on your C: drive, in the Program Files folder), you should be able to save the downloaded file anywhere, e.g., on your desktop.
  • Open the getline_Fixer folder, run the getline_Fixer.exe utility and follow the directions:
    • A screen of information appears describing the getline bug and warning the user not to run the utility if unsure about its origin.
    • You are asked whether you want to run the utility (y/n).
    • If the utility is successful, a message will be written that says so.
    • If the utility was not successful, it will probably be for one of these reasons:
      • Visual C++ was not found where expected
      • the "STRING" include file has already been altered from the original.
    • If Visual C++ was not found where expected, you will be instructed to move the entire getlineFixer folder to your MyProjects folder and run the utility again.
    • If the "STRING" include file has already been altered from the original, it may have been repaired already. You cannot use getlineFixer folder to repair it. If it has been repaired correctly, the sample program should produce the desired output. If not, you should follow the directions given at the Microsoft site to repair the problem.
  • Run the sample program again on your machine to determine whether getline() has indeed been repaired successfully.
 

Disclaimer:

This utility is provided only for students enrolled in CS 171-2 at Drexel University. No warranty against damage to your computing system is expressed or implied.


JL Popyack
Jan. 14, 2002