#include <stdio.h>
void readFile(char file[]) {
FILE *fp = fopen(file, "r");
char ch;
while ((ch = fgetc(fp)) != EOF)
putchar(ch);
fclose(fp);
}
void copyFile(char file[], char tofile[]) {
FILE *fp = fopen(file, "r");
FILE *tofp = fopen(tofile, "w");
char ch;
while ((ch = fgetc(fp)) != EOF)
fputc(ch, tofp);
fclose(fp);
fclose(tofp);
}
int main()
{
char file[100] = "d:\\data.txt";
char tofile[100] = "d:\\data_copy.txt";
copyFile(file, tofile);
readFile(tofile);
return 0;
}
/*
run:
c c++ c#
java python
*/