-
the file problem
I made a file of records.....each record consists of one integer field......now i wanna retrieve the value from the integer field......how to do that ? i used fscanf function but it doesn't work......the other fields are string value..
while(fgets(code,6,handle)!=NULL)
{ fgets(name,22,handle);
fgets(position,22,handle);
fscanf("%d",&age); // this is the integer value
printf("%s ",code);
printf("%s ",name);
printf("%s ",position);
printf("%-3d\n",age);
}
-
>i used fscanf function but it doesn't work......
Maybe it went on strike... try to pay more money... :p
Seriously, it will do something. What happens
when you run it ? What does it print ?
-
I have corrected it.....the problem was i forgot to put the file stream pointer in the fscanf function......btw...thank's for your kindness.....:)
-
oh... damn, you're right, I didn't even notice... whoops ;)
-
I have corrected it.....the problem was i forgot to put the file stream pointer in the fscanf function......btw...thank's for your kindness.....:)