Advertisement
Guest User

Leitura simples 1

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