I've spent hours, an embarrasing number of HOURS on how to read a text file into a program. The requirements have shifted, but still. I hate you C. You and all your pointers.
The text file is a matrix, but with the first line being the number of rows. See example below.
matrix_c_is_evil.txt
11 // int number of rows
a1 a2 a3 b1 // double (these can be negative)
...
a33 a34 a35 b11
I have read a lot of stuff. And I guess I'm tired, because it all seems to cirlce back to the same stuff that doesn't work. Does fscanf not work with negatives? I'm having a hard time confirming this.
Do I have to read in the entire file, then parse by fgets or fgetc (or whatever the individual char function is)?
Why is this such a pain in the donkey? If it were integers it seems like it would be a lot easier.