Firstly, I'm assuming that the file *format* you're using is your own, allowing you to modify it.

The easier way is to simply use scanf and read formatted text input instead. That makes various...