I've got a text file formatted like this:
100 0 10 1
101 6 10 1
102 8 4 1
103 12 20 1
104 19 15 1
105 30 5 1
106 35 10 1
I need to put these numbers into the arrays pID[], arrival[], bursts[], and priority[], respectively. C is not my strongest language, so I'm having some trouble doing this.
Here's my current code:
void readFile(int n, int pID[], int arrival[], int bursts[], int priority[]){
FILE *file;
int i = 0;
file = fopen("Process.txt", "r");
//File format is pID, arrival, bursts, and priority
if (file){
    while (!feof(file)){
        pID[i] = fscanf(file, "%d ", &i);
        arrival[i] = fscanf(file, "%d ", &i);
        bursts[i] = fscanf(file, "%d ", &i);
        priority[i] = fscanf(file, "%d ", &i);
    }
    fclose(file);
}
Thanks for any help!
 
    