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
Get step-by-step solutions from verified subject matter experts
