- #include <stdio.h>
- #include "file.h"
- int copy_file(const char *dest_path,const char *src_path)
- {
- char ch;
- FILE *fs = NULL;
- FILE *fd = NULL;
- fs = fopen(src_path,"r");
- fd = fopen(dest_path,"w");
- ch = fgetc(fs);
- while (!feof(fs))
- {
- fputc(ch,fd);
- ch = fgetc(fs);
- }
- }
- int main()
- {
- copy_file("./dest.dat","./src.dat");
- }
- //该片段来自于http://www.codesnippet.cn/detail/080420149265.html
来源: http://www.codesnippet.cn/detail/080420149265.html