loco
loco

Reputation: 9

C - Reading parts of a file

I have a file where each line has the following format: `%s %f %f \n.
Example:

I want to skip the name of the animals and just get the float values after that. How can I do this?

Upvotes: 0

Views: 516

Answers (2)

George
George

Reputation: 1380

You don't need a C program for this. Import the file in question to excel and remove the first column [which is the names of animals]. This will leave you with what you want.

Now you can save this file from excel.

Upvotes: -1

petrovich
petrovich

Reputation: 251

Just read all data with fscanf(f, "%s %f %f", str, &x, &y); but do not use str. Or better use fscanf(f, "%*s %f %f", &x, &y);

Upvotes: 5

Related Questions