Home      Affiliated Colleges      Course content      First Sem     Second Sem     Third Sem     Fourth Sem     Fifth Sem     Sixth Sem     Seventh Sem     Eighth Sem     Lab report 4th sem     Contact    

Wednesday, January 26, 2011

introduction to Cryptography: C Program to copy a file into a disk

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
    FILE *fs,*ft;
    char ch;
    clrscr();
    fs = fopen("vk.txt","r");
    if(fs==NULL)
    {
    printf("Cannot open source file ! Press key to exit.");
    getch();
    exit(0);
    }
    ft = fopen("ck.txt","w");
    if(ft==NULL)
    {
    printf("Cannot copy file ! Press key to exit.");
    fclose(fs);
    getch();
    exit(0);
    }
    while(1)
    {
    ch = getc(fs);
    if(ch==EOF)
    {
    break;
    }
    else
    putc(ch,ft);
    }
    printf("File copied succesfully!");
    fclose(fs);
    fclose(ft);
}

No comments:

Post a Comment

^ Scroll to Top Related Posts with Thumbnails ^ Go to Top