Code:
here is the code i have so far i guess i should have posted it originally
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_ELMNTS 100
#define ANLYS_RNG 20
//structure declaration
typedef struct
{
char color[MAX_ELMNTS];
char size[MAX_ELMNTS];
int qty[ANLYS_RNG];
double price[ANLYS_RNG];
} PAINTDATA[4];
//function declarations
void getdata (PAINTDATA);
void printdata (PAINTDATA);
//Functions in Other File
int main()
{
getdata (PAINTDATA);
printdata (PAINTDATA);
return 0;
}
void getdata (PAINTDATA)
{
FILE* infile;
int i;
infile = fopen ("paint.data", "r");
if (!infile)
{
printf ("File does not exist");
exit(1);
}
if(i=0; i<4; i++)
{
fscanf (infile, "%s, %s, %d, %lf ", PAINTDATA->color[i], PAINTDATA->size[i], &PAINTDATA->qty[i], &PAINTDATA->price[i]);
}
return;
}
void printdata (PAINTDATA)
{
int i;
if(i=0; i<4; i++;)
{
printf( "%s, %s, %d, %lf ", PAINTDATA->color[i], PAINTDATA->size[i], &PAINTDATA->qty[1], &PAINTDATA->price[i]);
}
return;
}