Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(){
- FILE *f1,*f2,*f3;
- int i;
- f1=fopen("archivo1.txt","r");
- f2=fopen("archivo2.txt","w");
- f3=fopen("archivo3.txt","w");
- printf ("\nSeleccione a cual archivo copiar: \n\n");
- printf ("1)Archivo2.txt\n");
- printf ("2)Archivo3.txt\n>> ");
- scanf ("%d", &i);
- switch (i){
- case 1:
- do{
- fprintf(f2,"%c", getc(f1));
- }while(!feof(f1));
- break;
- case 2:
- do{
- fprintf(f3,"%c", getc(f1));
- }while(!feof(f1));
- break;
- default:
- printf ("Opcion no valida\n");
- return 0;
- }
- fclose(f1);
- fclose(f2);
- fclose(f3);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement