Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ARQUIVO = file.txt
- /*
- 0 A A 1
- 0 B C 2
- 1 B B 1
- 1 C C 2
- 2 B B 1
- 2 B A 2
- */
- void readCsv() {
- FILE *fp = fopen("file.txt", "r");
- if(!fp) { printf("Erro ao abrir o arquivo.\n"); exit(1); }
- char destino[2], proximo[2];
- int custo = 0, num = 0, i= 0;
- while(!feof(fp)) {
- fscanf(fp, "%d %s %s %d", &num,destino,proximo,&custo);
- printf("%d %s %s %d \n",num, destino, proximo, custo);
- i++;
- }
- fclose(fp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement