cin.getline

This is a discussion on cin.getline within the C++ Programming forums, part of the General Programming Boards category; Okay this has me scratching my head :
I can use cin.getline in main fine by e.g.
char test[10];
cout ...

This is 99.99% probable that you have some chars left over in the streambuf before calling getline. getline takes this as its input. If you use cin>>something then the \n will be left in the stream. try adding cin.ignore(80,'\n') before the cin.getline()

Don't use cin.
Use only cin.getline, also for input of numbers.
Convert the string to int, double ... with atoi or atof.
Why?
Let's say you've defined int a;
with cin >> a; you hope to get an integer.
But if the user inputs anything else as an integer
you're in trouble, even cin.ignore() won't be able
to clear the buffer.

cin.getline(*char[], count, termchar) gets a line of characters up to a term character.

getline(cin,string,termchar) is a different function found in cstring and it gets characters and turns them into an ansi null terminated string. (which really isn't different than a null terminated array of characters... for most aspects)

All this is to the best of my recollection.... which is a bit fuzzy at the moment.