I'm working on an update function for my program. Here's how the function works out-

The user enters in a record they want to update, each record contains 3 entries. The user is presented with the first entry in that record. If they want to change the entry, they type it in and press enter. If they do not want to change the entry, they simply press enter. They will then be presented the 2nd entry, where they have the same options; either enter in the new information and press enter, or simply press enter and it will skip to the 3rd entry and leave the 2nd one intact.

I'm looking for a way to detect if just the new line character was entered in and nothing else. To do this I had a string named "buffer" that was initialized to empty. At each of the 3 instances to input, I did a getline( cin , buffer ). Then I checked if( buffer != "" ), then execute what I need to (or in other words update the information).

Here's a simple sample of what I'm trying to do-
Code:
string str1 = "", str2 = "", str3 = "";
string buffer = "";

cout << "Enter a new str1 value: ";
getline( cin , buffer );
if( buffer != "" )
{
    //update
    buffer = "";
}

cout << "Enter a new str2 value: ";
getline( cin , buffer );
if( buffer != "" )
{
    //update
    buffer = "";
}

cout << "Enter a new str3 value: ";
getline( cin , buffer );
if( buffer != "" )
{
    //update
    buffer = "";
}
Again this code doesn't seem to work for me; it is just a simple example. Any help would be appreciated, thanks.