#include<stdio.h>
#include<stdlib.h>

struct sales
{   int week;
    char name[20];
    int units;
    int price;
};

int main ()
{
    char data1[300];
    int itemAmount = 0;
    char itemNumber[10];
    int timeToFinish = 0;
    int elapsedMinutes = 0;
    int iLoop = 0;
    int readCounter = 0;
    int finishTime[20];//holds the finish items
    int counter = 0;

    printf ("Enter a filename to load: ");
    scanf ("%s" , &data1[0]);

    FILE *ptrFileIn;
    ptrFileIn= fopen("data1","r");

    if (ptrFileIn != NULL)
    {
       
        for (iLoop=0; iLoop<14; iLoop++)
        {
            finishTime[iLoop] = 0;
        }

        while (!feof(ptrFileIn))
        {
 fscanf(ptrFileIn, "%s %d %d", &itemNumber, &timeToFinish, 

&elapsedMinutes);
                finishTime[counter] = timeToFinish;
                //finishTime[counter] = elapsedMinutes;
                counter++;
        }

        printf ("\nFile successfully loaded!\n");
        fclose(ptrFileIn);

        for (readCounter = 0; readCounter < 15; readCounter++)
        {
            if (finishTime[readCounter] != 0)
            {
                printf("item%d %d %d\n", readCounter, finishTime

[readCounter]);
            }
        }
    }

    else {
        printf("Error: The file you specified could not be found!");
    }

    system ("PAUSE");
    return 0;
}

What is your question -- perhaps you forgot to post it? If you have a question about the code you posted then you have to tell us because we are not mind readers.

I don't know what is your question. However, I found you have a small mistake in line 27.

ptrFileIn= fopen([B]"data1"[/B],"r");

I think it suppose to be

ptrFileIn= fopen([B]data1[/B],"r");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.