I have a structure set up from some earlier help. Now when I try to write the data to the disk I only write zero's. I have no idea what I have done wrong or why this is happening. I realize this is not the complete program but shows the structure setup. then the disk write section. If I capture say 3 sets in the program I can print them to the screen with the correct data the disk file shows this
0,0,0,0,0,0
0,0,0,0,0,0
0,0,0,0,0,0
struct batch
{
int a,b;
double c,d,e;
int f;
};
struct batch batch [2000];
int temprec=0;
int w;
BatOut=fopen("batch1.csv","w");
if (BatOut==NULL)
{
clrscr();
gotoxy(12,10);
cprintf("Disk Error");
}
else
{
for(w=0;w<=temprec;w++)
{
fprintf(BatOut," %d, %d, %g, %g, %g, %d\n",
batch[temprec].a, batch[temprec].b, batch[temprec].c,
batch[temprec].d, batch[temprec].e, batch[temprec].f);
}
}
fclose(BatOut);