You probably need to use a tokenizer for that kind of things to parse the input correctly, since you don't know what may it consist of (so can't use sscanf). As for file parsing, yes it does make it easier, if you know the structure is fixed. If the structure is variable, well then you're at point 1. Split the input by spaces and decide what type you want to cast the parts to, based on context.