hello sir. i am trying to create a program that will perform read/write operation on csv file. i am using structure. my structure and code is as follow:
struct item
{
int item_no;
char item_name[20];
float rate;
}i1;
main()
{
.
.
fprintf(fp,"%d,%-20s,%.2f\n",i1.item_no,i1.item_name,i1.rate);
.
.
.
fscanf(fp,"%d%*c %s%*c %f",&i1.item_no,i1.item_name,&i1.rate);
printf("%d %s %.2f\n",i1.item_no,i1.item_name,i1.rate);
.
.
}
but printf is printing wrong value of rate like this:
101 Mobile 0000.00
but the actual o/p should be like:
101 Mobile 5000.00
values in item.csv file are correctly written. so i think there is problem with fscanf()
please reply me as soon as possible...
thank u in advance....