Archived

This topic is now archived and is closed to further replies.

fstream

This topic is 5341 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Could you please tell me how can I read (skip) line in fstream. For ex. I read the first char, if it is equal to smthn. then I read folowing int''s, if not, I skip to next line. I am using file.getline(buff,size,''\n''); now, but that means data is read in buffer, actually all I need is skip to next line. sscanf/ffscanf had %*w notation to disable writing. ______________________________ Madman

Share this post


Link to post
Share on other sites
INT_MAX is the maximum signed int value, and should be defined as something like 2147483647. it's defined in climits (or limits.h), but i believe iostream or fstream includes this, so you shouldn't need to. You could substitute INT_MAX with any value you wanted in the ignore function - for example if you wanted to skip only a certain amount of characters - but since you want to toss the whole line, the INT_MAX pretty much guarantees you'll hit everything on the line before \n

[edited by - bjl3784 on May 5, 2003 10:31:46 AM]

Share this post


Link to post
Share on other sites