re 425 project program 5
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <time.h>
#include <isam.h>
#include <common.h>
FILE *fp_stock_master;
FILE *fp_out;
int x=1;
RECORD_DATA *stock_rec;
int main()
{
if((fp_stock_master=fopen("A:STCKMAST.DAT","rb"))= =NULL)
{
printf("ERROR OPENING STOCK MASTER FILE\n");
exit(1);
}
else
printf("OPENING STOCK MASTER FILE\n");
while (x==1 )
{
if(fread(stock_rec,sizeof(RECORD_DATA),1,fp_stock_ master)!=1)
{
if(feof(fp_stock_master))
{ printf("end of file");x=0;strcpy(stock_rec->desc,"\0");break;}
else if(!feof(fp_stock_master)) /*else reading error*/
{printf("\nERROR READING CUSTOMER MASTER FILE - PROGRAM TERMINATED");exit(1); }
}
if(x==1)
printf("%6s %19s %02d %06ld %04d %06s %06.2f\n",stock_rec->key,stock_rec->desc,
stock_rec->supp_code,stock_rec->free_stock,stock_rec->min_stock,
stock_rec->movement_date,stock_rec->price);
}
fclose(fp_stock_master);
return 1;
}
this is trying to read my master file and it just gives a value of null for the stock_rec->key
i cant get a value for the part number at all and am having real problems with this program.
can anyone help
steve