I am trying to read the ints from a CSV file into a 2D-Array.
Here is my code...
FILE* fp = fopen(argv[1], "r");
int counter = 0;
char line[50];
while (fgets(line, 50, fp)) {
counter++;
}
int arry[counter - 1][4];
NUM_ROWS = counter -1;
counter = 0;
//Iterate File Again to Populate 2D Array of PID, Arrival Time, Burst Time, Priority
//File in Format: #,#,#,#
rewind(fp);
//Skip First Line of Var Names
fgets(line, 50, fp);
while(fgets(line, 50, fp)) {
sscanf(line, "%d%d%d%d", &arry[counter][0], &arry[counter][1], &arry[counter][2], &arry[counter][3]);
counter++;
}
However, sscanf() is not reading the line into the array. I am unsure why this is not working