#include<stdio.h>
void main(int argc , char *argv[])
{
FILE *file1,*file2;
char line[100];
// remember file should exist
file1 = fopen(argv[1],"r");
file2 = fopen(argv[2],"w");
printf("output of copy(cp) command\n");
// reading file line by line entering to buffer line
while(fscanf(file,"%[^\n]\n",line)!=EOF)
{
fprintf(file2,"%s\n", line);
}
// file close
fclose(file1);
fclose(file2);
}
void main(int argc , char *argv[])
{
FILE *file1,*file2;
char line[100];
// remember file should exist
file1 = fopen(argv[1],"r");
file2 = fopen(argv[2],"w");
printf("output of copy(cp) command\n");
// reading file line by line entering to buffer line
while(fscanf(file,"%[^\n]\n",line)!=EOF)
{
fprintf(file2,"%s\n", line);
}
// file close
fclose(file1);
fclose(file2);
}
Comments
Post a Comment