Write a ‘C’ program to copy content of one file into another file using command line argument
#include<stdio.h>
#include<conio.h>
main(int argc,char *argv[])
{
FILE *fp1,*fp2;
char ch;
clrscr();
if(argc!=3)
{
printf("\n insufficient argument ");
exit(0);
}
fp1=fopen(argv[1],"r");
fp2=fopen(argv[2],"w");
if(fp1==NULL || fp2==NULL)
{
printf("\n unable to open file ");
exit(0);
}
while(!feof(fp1))
{
ch=fgetc(fp1);
fputc(ch,fp2);
}
printf("\n file successfully copied ");
fclose(fp1);
fclose(fp2);
getch();
}
#include<conio.h>
main(int argc,char *argv[])
{
FILE *fp1,*fp2;
char ch;
clrscr();
if(argc!=3)
{
printf("\n insufficient argument ");
exit(0);
}
fp1=fopen(argv[1],"r");
fp2=fopen(argv[2],"w");
if(fp1==NULL || fp2==NULL)
{
printf("\n unable to open file ");
exit(0);
}
while(!feof(fp1))
{
ch=fgetc(fp1);
fputc(ch,fp2);
}
printf("\n file successfully copied ");
fclose(fp1);
fclose(fp2);
getch();
}
Write a C program that reads the file name and text of 20 words as command line arguments. Write the text into a file whose name is given as the file name.
ReplyDeleteM
Deleteplease visit my blog arungirivasan.blogspot.in and comment your opinion.it is also about c programs
ReplyDeleteWrite a program using command line parameters to append one text file to another text file.
ReplyDeleteIt's showing declaration terminated incorrectly
ReplyDeletethanks
ReplyDeleteWrite a program to print the records in reverse order. The file must be opened in binary modw
ReplyDeleteThis is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
ReplyDeleteWeb Designing Course Training in Chennai | Web Designing Course Training in annanagar | Web Designing Course Training in omr | Web Designing Course Training in porur | Web Designing Course Training in tambaram | Web Designing Course Training in velachery
This is a subject which is important to me... Good health! Where are your contact subtleties however?
ReplyDeletelive
ReplyDeleteThis blog is very infomative thanks for providing us this blog
Oracle Training in Noida
Nice information.Thanks for the post.
ReplyDeleteFull-stack classes in Nagpur