Professional Documents
Culture Documents
Raghu Institute of Technology
Raghu Institute of Technology
Raghu Institute of Technology
R13 Syllabus
FLOWCHART:
Start
Declare ch
If
argc!=3
True
Insufficient data
stop
fp1==null||fp2=
=null
True
True
False
(!f eof(fp1))
Stop
PROGRAM
/*C program to copy one file content to another file */
Program name:
// wk16a.c
/* Done By : C-Faculty
#include<stdio.h>
#include<curses.h>
int main(int argc,char *argv[]);
{
FILE *fp1,*fp2;
char ch;
clear();
if(argc!=3)
{
printf(insufficient data);
return(0);
}
fp1=fopen(argv[1] ,r);
fp2=fopen(arg[2] ,w);
if(fp1==NULL||fp2==NULL)
{
printf(files are not opening);
return(0);
}
while(!f eof(fp1))
{
ch=fgetc(fp1);
fputc(ch,fp2);
Department of Computer Science & Engg
Dated: 15/10/2013*/
}
printf(files successfully copied);
fclose(fp1);
fclose(fp2);
return(0);
}
PROCEDURE FOR EXECUTING THE PROGRAM:
Step 1: After typing the program, press ESC button+shift+: and then type wq(to save the program and
quit)
Step 2: Now compile the program by using the following command
cc wk16a.c lcurses
Step 3: Now go for running the program by using the command
./a.out
hi.txt
bi.txt
--xXx--