Reading from file

Hello i have a file with entries like this:
M 5
R 01/01/2010 1800 2107070770
U 01/01/2010 1810 2104570770

I'm really messed up with the function that read elements..
I need a code which will read the first char and if =! M will do these:
string date=01/01/2010;
int code =1800;
int number=2107070770;
Post your code so far.
1
2
3
4
5
6
7
8
9
10
11
12
13
        char funct;
	char string[15];
	int numbl;
	int code;
	
     
     while (!feof(from))
     {
		
	 fscanf(from,""%c %s %d %d",&funct ,string,&numbl,&code);
	printf("funct:%c strng:%s number:%d code:%d\n",funct,string,code,numbl);
		
	} 


but when the line starts with M it all messes...
Last edited on
The Output is this:

funct:M strng:5 number:957468086 code:0
funct:R strng:01/01/2010 number:2107070770 code:1800
funct: strng:U number:2107070770 code:1
Topic archived. No new replies allowed.