#include<stdio.h>
#pragma warning(disable:4996)
#include<time.h>
int main(void)
{
unsigned int start = time(NULL);
char arr[1024];
FILE * fp = fopen("D:\\1.avi", "rb");
FILE * fp1 = fopen("D:\\2.avi", "wb");
if (!fp)
{
printf("文件打开失败!");
return -1;
}
while (!feof(fp)) //如果文件结束返回非0值,否则返回0;
{
memset(arr, 0, 1024);
fgets(arr, 1024, fp);
fputs(arr, fp1);
}
fclose(fp);
fclose(fp1);
unsigned int end = time(NULL);
printf("%d(s)\n", end - start);
return 0;
}
为什么用上面fgets和fputs拷贝一个视频文件,300多兆的视频只能拷贝80多兆,而用fgets、fputs与fread、fwrite都能够完全拷贝下来。上面代码哪错了吗?