i'm trying to learn how to reading data from files into an array
and process the data. i can't figure out what i'm doing wrong
i have a sales.txt file that contains(two columns- salesman # and amount of a sale) that i'm reading into two arrays salesnum and salesamt. i want to store salesman number in salesnum array and salesamount in salesamt array..i'm trying to tally up the amount of sales and number of sales each salesperson has.
when reading in the file to the arrays it only reads the first 5 lines
not the next 10.
my arrays can only be five elements because there are only 5
salesmen but there are 15 sales....i don't know what i'm doing
wrong basically...could use some help
could someone look at this please


#include <stdio.h>
#define MAXSALESPERSON 5

void ProcessData( int salefilenum, float saleamt, int salesnum[], float salesamt[]);
void ReportFile(int salesnum[], float salesamt[]);
void ErrorData(int salefilenum);

main()
{

FILE *salefile_ptr;

int salefilenum;
float saleamt;
int i;

int salesnum[MAXSALESPERSON] = {0};
float salesamt[MAXSALESPERSON] = {0};

/* salefile_ptr = fopen("sales.txt", "r");a */

salefile_ptr = fopen("sales.txt", "r");

if(salefile_ptr != NULL)
{
while(fscanf(salefile_ptr, "%d %f", &salefilenum, &saleamt) != EOF)
{
ProcessData(salefilenum, saleamt, salesnum, salesamt);
ReportFile(salesnum, salesamt);
}
fclose(salefile_ptr);
}
else
printf("\nReport file not opened!\n");


printf("\nEnd of job..\n\n");
}

void ProcessData( int salefilenum, float saleamt, int salesnum[], float salesamt[])
{
if( (salefilenum <= 0) || (salefilenum > MAXSALESPERSON) )
{
ErrorData(salefilenum);
}
else
{
salesnum[salefilenum - 1] = salefilenum;
salesamt[salefilenum - 1] = saleamt;
}
}

void ReportFile(int salesnum[], float salesamt[])
{
FILE *reportfile_ptr;
reportfile_ptr = fopen("report.txt", "w");
int j;
for (j = 0; j < MAXSALESPERSON; j++)
{
fprintf(reportfile_ptr, "%d\t%2.1f\n", salesnum[j], salesamt[j]);
}
fclose(reportfile_ptr);
}


void ErrorData(int salefilenum)
{
FILE *Error_ptr;
Error_ptr = fopen("err_report.txt", "w");
fprintf(Error_ptr, "%d is out of range\n", salefilenum);
fclose(Error_ptr);
}