Question: C programming: please explain the following code line by line, the more explanation the better. Thank you. if ( fp1 != NULL ) { char

C programming: please explain the following code line by line, the more explanation the better. Thank you.

if ( fp1 != NULL )

{

char line[256];

while ( fgets ( line, sizeof line, fp1 ) != NULL )

{

char * tokenize = strtok(line, "\"");

to_lower(tokenize);

if ( strstr(tokenize, STOCK TKR_ )) {

tokenize = strtok(NULL, "\"");

tokenize = strtok(NULL, "\"");

name = strdup(tokenize);

tokenize = strtok(NULL, "\"");

tokenize = strtok(NULL, "\"");

tokenize = strtok(NULL, "\"");

tokenize = strtok(NULL, "\"");

tokenize = strtok(NULL, "\"");

tokenize = strtok(NULL, "\"");

tokenize = strtok(NULL, "\"");

tokenize = strtok(NULL, "\"");

tokenize = strtok(NULL, "\"");

tokenize = strtok(NULL, "\"");

sector = strdup(tokenize);

tokenize = strtok(NULL, "\"");

tokenize = strtok(NULL, "\"");

industry = strdup(tokenize);

break;

}

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!