Bienvenido a Tecnohackers

Tecnohackers » Programacion » Area de Programacion » Programacion a Bajo Nivel. APIs, Hooking, ASM, C/C++, etc.
 » 

Redirigir archivo



Autor Tema: Redirigir archivo  (Leído 886 veces)

Desconectado P4|3L0

  • Asiduo
  • *
  • Mensajes: 75
  • TecnoHacker un nuevo proyecto.
    • http://www.tecnohacker.com
Redirigir archivo
« en: Diciembre 29, 2009, 10:54:48 am »
Código: You are not allowed to view links. Register or Login
#include <stdio.h>
#include <stdlib.h>
int main()
    {
    FILE *origen, *destino;
    char copiar;

    origen=fopen("origen.txt","r"); /*aqui se pone el archivo a copiar*/
    destino=fopen("destino.txt","w"); /*aqui se pone el archivo donde se va a copiar*/
    if (origen==NULL || destino==NULL)
       {
       printf( "Problemas con los ficheros.\n" );
       exit( 1 );
       }
    copiar=getc(origen);
    while (feof(origen)==0)
          {
          putc(copiar,destino);
          printf( "%c",copiar );
          copiar=getc(origen);
          }
    if (fclose(origen)!=0)
       printf( "Problemas al cerrar el fichero origen.txt\n" );
    if (fclose(destino)!=0)
       printf( "Problemas al cerrar el fichero destino.txt\n" );
    }



Tags:
Tags:

 


SMF 2.0.19 | SMF © 2016, Simple Machines
Paginas Afiliadas
Twitter - FaceBook - Daraxblog
Designed by Smf Personal