Advertisement
Guest User

Leitura simples 3

a guest
Oct 20th, 2012
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     FILE* p_arquivo = NULL;
  7.     char letra;
  8.  
  9.     //abre o arquivo
  10.     p_arquivo = fopen("MD5SUMS", "r");
  11.  
  12.     if (p_arquivo == NULL)
  13.     {
  14.         printf("Erro na abertura do arquivo\n");
  15.         exit(1);
  16.     }
  17.  
  18.     while ( feof(p_arquivo) == 0 ) {
  19.         letra = fgetc(p_arquivo);
  20.         if (feof(p_arquivo))
  21.             break;
  22.  
  23.         printf("%c", letra);
  24.     }
  25.  
  26.     //fecha o arquivo
  27.     fclose(p_arquivo);
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement