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? :confused:
Printable View
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? :confused:
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 :-)
I see what your saying, thank you very much,that worked! Your english seems to be coming along very well:D Thanks again.