Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get words seoarated by pipe delimiters

Status
Not open for further replies.

pjb

Programmer
May 1, 2001
148
US
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.

If you still get problems post your code.

Regards,
SwapSawe.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top