directly `fscanf`...?!
please try to use `LineReader` and `Parser` classes for doing the whole parsing... see `LibSVMFile` as a good example.