Hey guys
If I am using an ifstream to read in data, and have systematically read data on the first line, How do I skip to the next line at the end of the line?
Any ideas?
Thanks.
Asp
Hey guys
If I am using an ifstream to read in data, and have systematically read data on the first line, How do I skip to the next line at the end of the line?
Any ideas?
Thanks.
Asp
Call getline() two times.
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
hey magos getline is an ifstream method, what if he's using fread? is there any equivalent function or you just have to do it manually?
EDIT: i.e with fseek?
>EDIT: i.e with fseek?
Only if you know the length of the line and the file is opened in binary mode. This would work for well formatted files, but anything else it would be easier to just read the next line and discard it.
-Prelude
My best code is written with the delete key.
Originally posted by Silvercord
hey magos getline is an ifstream method, what if he's using fread? ...Originally posted by aspand
If I am using an ifstream to read in data, ...
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.