Question: Unix and C code. I need to write code into case 3 and 4 so that the code also fetches the studio and number of
Unix and C code. I need to write code into case 3 and 4 so that the code also fetches the studio and number of theaters the movies were played in and output that as well as what is already being outputted
#include
struct movie_type{ char name[128]; char gross[128]; char studio[128]; char numTheaters[128]; };
char *ptr, buffer[16392], cmd[512]; char company_name[128], zipcode[64]; //char wind_speed[64], wind_direction[64]; //char us_state[32], us_city[128], tod[64]; int i, n, first_time, indx, state; struct movie_type movies[MAX_MOVIES];
int main(int argc, char *argv[]){ FILE *fp; sprintf(cmd,"wget -qO- http://www.boxofficemojo.com/weekend/chart/");
if((fp = popen(cmd, "r")) != NULL) { state = 0;
while (!feof(fp)){ if (fgets(buffer, sizeof(buffer) - 1, fp) != NULL){ switch (state){ case 0: if (strstr(buffer, "
