cin.getline : strange error
Hello everyone. What I am simply trying to do is to read two names that can contain spaces.
Here is my code:
I tested the same code inside main and it works normally but now, in this function something strange occurs. What I see when run the program is
void Foo :: Cinema
char title, director;
cout << "Give me the title :" << endl;
cin.getline(title, 20, '\n');
cout << "Give me the director : " << endl;
and as a result I can put only the name of the director.
Give me the title :
Give me the director : (cursor here)
What could be wrong? How can I fix this?
p.s. I use Visual Studio 2005