i tried to come up with an execise that would challenge me and it worked out too good. what i came up with is to parse some input, but i made it hard to do right. the input is a string with a bunch of fields, but the fields can have spaces and two of them are optional, heres the setup
firstname is optional, so is height, date can have spaces or any character separating each number, address can be pretty much anything and hobby is a complete sentence of any length.lastname <firstname> date age <height> address hobby
what i've come up with so far is to read the entire string and then use sscanf on all of the fields up to address, i think i have it worked out okay but i cant figure out how to read the address and hobby separately without botching things up.
am i on the right track or is this totally wrong ? and how can i read everything so that it can work with the optional fields as well?