The problem I'm having is that cin.getline is being skipped. It skips user input and goes to the next line of code.
char setName[ 50 ];
// set name
cout << "Enter a name for your character(50 char. max): ";
cin.getline( setName, 49 );
sTransfer = setName;
sName[ 0 ] = sTransfer;
I have no idea what is wrong with getline. If I do this:
It works fine. User input works and hstring outputs the entered string.
using namespace std;
char *hstring[ 1 ];
char name[ 50 ];
cout << "Enter a string: ";
cin.getline( name, 49 );
s1 = name;
hstring[ 0 ] = s1;
cout << "\n" << hstring[ 0 ] << endl;
What to do? I'm clueless!
One thing I noticed: In the first example, (I'm using MSVC++6.0 btw) if I put my mouse over sName[ 0 ], a tooltip pops up showing "char sName[ 50 ]" but if I put my mouse over hstring in the first example, the tooltip reads, "char *hstring".
Why does it show two different things when both the code is exactly the same except with different named variables?
Thanks in advance for replies