Using values from txt

My question may sounds stupid, but I am a newbie in programming, so any help will be appreciated.

I have a txt file of number coordinates written in the following format:
1 2 3
4 5 6
...
...
10 11 12

and what I wanna do now is to take number 1,2,10,11 for further operations, this is what I have done so far
1
2
3
4
5
6
7
8
9
10
11
12
13
14
FILE* xymsource;
	long len;
	char *buf;
	xymsource=fopen("xym increX=10, increY=6.log","rb");
	if (!xymsource) 
    {
        printf("fail to open xym.txt...\n");
        exit(1);
    }
	fseek(xymsource,0,SEEK_END);
	len=ftell(xymsource);
	fseek(xymsource,0,SEEK_SET);
	buf=(char *)malloc(sizeof(char)*len);
	fread(buf,len,1,xymsource);


so the numbers are saved in buf, but then I am not sure how to take the four numbers I want out of it. Can anyone please help? Thanks
Okay, first of all, that's C style file operation.
It's ok, just not want to confuse you.
If I were you, I would read things from file into some appropriate data structure (like array) in one pass. Then access the ones I want.
However, if the data is really a "one time business", don't bother storing all the stuff in the file. You could check the data pieces while you're reading them from file; discard useless stuff and store the wanted.
Make your own judgement on the situation.
Thanks for your advice, I have got it done =]
Topic archived. No new replies allowed.