I'm trying to use the getline function to output to a file so I can prompt a user for a sentence and write that to a file, the getline function only seems to work once in the program and skips over it evertime after that?
I'm trying to use the getline function to output to a file so I can prompt a user for a sentence and write that to a file, the getline function only seems to work once in the program and skips over it evertime after that?
write "cin.ignore();" before getline(var,5) (example)
getline read 5 letters or enter. than he add \n.
the next geline get the \n (enter) and ignore it, so you must clean the puffer with cin.ignore();
i hope you understand it, my english isn't very good but i hope i will be better :-)
Last edited by sphreak; 01-03-2003 at 01:33 PM.
I see what your saying, thank you very much,that worked! Your english seems to be coming along very well Thanks again.