recopie.c
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 
00004 #define FILEIN  "entree.txt"
00005 #define FILEOUT "sortie.txt"
00006 
00007 int main() 
00008 {
00009     FILE *fi, *fo;
00010     int c;
00011 
00012     
00013     if ( (fi = fopen(FILEIN, "r")) == NULL ) {
00014         perror("[Erreur] fopen (read)");
00015         return 1; 
00016     }
00017     
00018     if ( (fo = fopen(FILEOUT, "w")) == NULL ) {
00019         perror("[Erreur] fopen (write)");
00020         return 1; 
00021     }
00022     
00023     while (1) {
00024         c = getc(fi); 
00025         if ( feof(fi) ) break;
00026         putc(c, fo);  
00027     }
00028     
00029     fclose(fi);
00030     fclose(fo);
00031     return 0;
00032 }