In c, read floats from one line, seperated by space [duplicate]

Yeah, typically the advice is to freadf() a line and then parse it, but if you have a really large block of data on one line then you can eat it piecemeal.

fscanf("%f ",&derp);
fscanf("%f ",&derp);
fscanf("%f ",&derp);
  fscanf("%f ", &mrMatrixomatic[mahIndex++]);

Just realize that fscanf can choke and die in a horrible fire if the formatting isn’t exactly correct.

Browse More Popular Posts

Leave a Comment