Advertisement
gtw7375

Manipulação de Arquivos - Leitura

Dec 4th, 2014
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. main(){
  4.    
  5.     FILE *arq_teste;
  6.    
  7.     char n;
  8.     arq_teste = fopen("teste.txt", "r");
  9.    
  10.     if(arq_teste == NULL){
  11.        
  12.         printf("Erra na abertura do arquivo teste.txt.\n/");
  13.         system("pause");
  14.         exit(-1);
  15.     }
  16.    
  17.     while(!feof(arq_teste)){
  18.        
  19.         fscanf(arq_teste, "%c", &n);
  20.         printf("%c\n", n);
  21.     }
  22.    
  23.     fclose(arq_teste);
  24.     system("pause");
  25.    
  26.    
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement