I have to read in records from a file. The records have variable length data fields or words, separated by pipe symbols "|". The number of words on a record is constant. How do I get the individual words??
Accept the field in a string till the '|' is encountered so as to get one field and if you get a '\n' you'll get a record.
After that if you have any field which has integers you can parse them using strtol() as suggested by Russ.
You can check EOF flag in a while loop hence finding your records till the EOF.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.