#include
main(int argc, char **argv)
{
FILE *s_ptr , *t_ptr;
char ch,c;
if(argc!=3)
{
printf("ERROR: Invalid no. of Arguments\n");
printf("Usage: copy \n");
return;
}
s_ptr = fopen(argv[1],"r");
if(s_ptr==NULL)
{
printf("Source File not Found\n");
return;
}
t_ptr = fopen(argv[2],"r+");
if(t_ptr==NULL)
{
t_ptr = fopen(argv[2],"w");
while((c=fgetc(s_ptr))!=EOF)
fputc(c,t_ptr);
}
fclose(s_ptr);
fclose(t_ptr);\
remove(argv[1]);
}
main(int argc, char **argv)
{
FILE *s_ptr , *t_ptr;
char ch,c;
if(argc!=3)
{
printf("ERROR: Invalid no. of Arguments\n");
printf("Usage: copy
return;
}
s_ptr = fopen(argv[1],"r");
if(s_ptr==NULL)
{
printf("Source File not Found\n");
return;
}
t_ptr = fopen(argv[2],"r+");
if(t_ptr==NULL)
{
t_ptr = fopen(argv[2],"w");
while((c=fgetc(s_ptr))!=EOF)
fputc(c,t_ptr);
}
fclose(s_ptr);
fclose(t_ptr);\
remove(argv[1]);
}
No comments:
Post a Comment