Advertisement
mateuspl

leitor.c

Jan 10th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.95 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main() {
  5.     FILE *mainfile;
  6.     mainfile = fopen("texto.txt", "r+");
  7.     if (mainfile == NULL) { printf("ERROR"); }
  8.     else { printf("OK"); }
  9.  
  10.     unsigned char string[100][10001];    // [cada quebra de linha][letras]
  11.     int qnt;    // quantidade de quebra de linha
  12.     int f, f2;    // usos variados (for)
  13.  
  14.  
  15.     for (qnt = 0; qnt < 100; qnt++) {
  16.         printf("\nPonto.");    // O erro na execução ocorre após "Ponto."
  17.         fgets(mainfile, 9999, string[qnt]);
  18. /*
  19. O compilador compila, mas também apresenta esses dois erros:
  20.    [Warning] passing arg 1 of `fgets' from incompatible pointer type
  21.    [Warning] passing arg 3 of `fgets' from incompatible pointer type
  22. */
  23.  
  24.         for (f = 0; f < 9999; f++) {
  25.             printf("\n> %d", f);
  26.                 if (string[qnt][f] == 255) { goto goto_EOF; }
  27.                 if (string[qnt][f] == '\0') { break; }
  28.         }
  29.     }
  30. goto_EOF:
  31. (...) }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement