The enter key on windows generates "\r\n", on unix "\n" and on mac "\r". Have fun!
The enter key on windows generates "\r\n", on unix "\n" and on mac "\r". Have fun!
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
I was just having a problem using getline myself and I found this thread in the search. Just wanted to note that
Does not work. I think cin.getline() expects a name and a length. Not a name and a delimiter. At least in VC7 it throws an error.Code:char name[15]; cin.getline ( name, '\n' );
I have been trying
which compiles fine but when the program is run the user is never prompted to enter anything. =/Code:getline(cin, string, '\n');
~Joshua Norton
Regards,
~Joshua Norton
Bah nevermind. Of course I find the answer as soon as I post the problem.
seemed to correct it.Code:cin.ignore()
~Joshua Norton
Regards,
~Joshua Norton
Well. Corrected it in dev C++ anyways. VC7 still skips right through the getline call. =/
Regards,
~Joshua Norton