I am trying to parse a text file that has the following format:
I am supposed to take the first line "3", and allocate memory for the 3 lines after it.
Then I want to skip the first line, and start parsing and tokenizing the the next 3 lines into a struct array.
I wrote the code below, but it is not working. Please note that I am a beginner in C, and I wrote this according to my very basic knowledge about C:
newFlows = malloc(sizeof(Flow)*numberOfFlows);
for(i = 0; i < (1+numberOfFlows); i++)
char *flow = malloc(sizeof(char)*15);
fgets(flow, 15, file);
char flowNo = flow;
char *arrivalTime = strtok(NULL, ",");
char *transmissionTime = strtok(NULL, ",");
int priority = flow;
Please guide me to how modify this code.
Thanks in advance