7 FILE *meteotextin, *meteotextout; 8 // define working variales 9 char c[250]; 10 char extr_str[51]; 11 char *result; 12 int x=0; 13 14 system("wget -N -q -O ./meteo.html http://text.weatheroffice.gc.ca/forecast/city_e.html?qc-148&unit=m"); 15 system("html2text ./meteo.html > ./meteo.txt"); 16 meteotextin = fopen("meteo.txt", "r"); 17 18 if(meteotextin==NULL){ 19 printf("Fichier introuvable !"); 20 return 1; 21 }else 22 while(fgets(c,250,meteotextin)!=NULL) { 23 if(strstr(c,"Observed at:")){ 24 x=0; 25 while(x<32){ 26 extr_str[x]=c[x+27]; 27 printf("%c",extr_str[x++]); 28 } 29 extr_str[0]='\0'; 30 } 31 32 if(strstr(c,"Temperature:")){ 33 fgets(c,250,meteotextin); 34 for(x=6;c[x]!='\n';x++) printf("%c",c[x]); 35 printf("\n"); 36 }