#include
#includemain(int argc, char *argv[ ])
{
FILE *s, *t;
char c;
if(argc!= 3)
{
puts("Wrong no. of parameters.\n");
printf("Correct command should be filename file 1 file2.");
}
s = fopen(argv[ 1 ], "r");
if(s = NULL)
printf("source file not found\n");
exit();
}
t = fopen(argv[2],"a");
if(t==NULL)
{
puts("target file cannot be created \n")
fclose(s);
exit();
}
while((fgete(s))!= EOF)
fputc(c,t);
puts("Files concatenated successfully.\n");
fclose(s);
fclose(t);
}
No comments:
Post a Comment