Splitting line into parts

If I read in a single line from a text file that contains a known delimiter, how can I:
a) split it up into the various parts
b) make sure that the respective parts are the respective types: a filename string, ints, and possibly others

It's also possible that one of the 'parts' is missing in a string, for example something like this:

filename.ext|5000|750   <-- all values present
filename.ext|2500|      <-- missing last value
filename.ext||500       <-- missing second value
filename.ext||          <-- missing all values

should all be considered valid. The delimiters are always there, however anything after the filename is optional and should translate to either zero or null. The program will test for those values and react accordingly.

have a look at the strtok() , e.g. this example should help you - C library function - strtok() -

Awesome, that will get me going. How do I go about setting each token to the correct type? I'll have a string for filename, INTs, a float, possibly several of them per line ...

when they arrive over serial they are all characters.

the array of chars that represent a float can be converted with atof() ints with atoi() R

Read THE book on C from Kerningham and Ritchie, worth every penny and more.