Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void)
- {
- FILE *fp = fopen("voos.txt", "r");
- if(!fp) { printf("Erro ao abrir o arquivo.\n"); exit(1); }
- int voo;
- char id[4] = {0}, cia[30] = {0}, cidade[30] = {0}, hora[10] = {0}, obs[15] = {0};
- /* G3 2161;Gol;(FLN) Florianopolis;9:05 AM;En Route; */
- while(fscanf(fp, "%s %d;%[^';'];%[^';'];%[^';'];%[^';'];\n", id, &voo, cia, cidade, hora, obs) != EOF)) {
- fprintf(stdout, "%s %d;%s;%s;%s;%s;",id, voo, cia, cidade, hora, obs);
- }
- fclose(fp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement