Code:
void set_characterNameAgeSex()
{
char setName[ 50 ];
char *sTransfer;
short setSex;
short setAge;
// set name
cout << "Enter a name for your character(50 char. max): ";
cin.getline( setName, 49 );
sTransfer = setName;
sName[ 0 ] = sTransfer;
The problem I'm having is that cin.getline is being skipped. It skips user input and goes to the next line of code.
I have no idea what is wrong with getline. If I do this:
Code:
#include <iostream>
using namespace std;
char *hstring[ 1 ];
void whatever();
int main()
{
char *s1;
char name[ 50 ];
cout << "Enter a string: ";
cin.getline( name, 49 );
s1 = name;
hstring[ 0 ] = s1;
cout << "\n" << hstring[ 0 ] << endl;
return 0;
}
It works fine. User input works and hstring[0] outputs the entered string.
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[0] in the first example, the tooltip reads, "char *hstring[0]".
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