/*
 * Cópia de arquivo para outro arquivo.
 */
#include<stdio.h>

int main() {
  FILE  *fr, *fw;
  char c;
  
  fr = fopen ("teste.txt", "r");
  fw = fopen ("saida.txt", "w");

  if (fr == NULL) {
    perror("teste.txt");
    return 1;
  }

  if (fw == NULL) {
    perror("saida.txt");
    return 2;
  }
  
  while (fscanf(fr, "%c", &c) != EOF)
    fprintf(fw, "%c", c);
  
  fclose(fr);
  fclose(fw);
  
  return 0;
}