Advertisement
Guest User

Leitura simples 2

a guest
Oct 20th, 2012
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 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(1){
  19.         letra = fgetc(p_arquivo);
  20.         if (feof(p_arquivo))
  21.             break;
  22.         printf("%c", letra);
  23.     }
  24.  
  25.     //fecha o arquivo
  26.     fclose(p_arquivo);
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement