📄 bin_file_copy_test.cpp
字号:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void bin_file_copy_test()
{
FILE *fp_in,*fp_out;
unsigned char ch;
if( (fp_in = fopen( "E:\\C++_sample\\File_operating\\bin_file_test.m4v", "rb" )) == NULL )
{
printf("cannot open the file bin_file_test.m4v\n");
exit(0);
}
if( (fp_out = fopen( "E:\\C++_sample\\File_operating\\copy_bin_file.m4v", "wb" )) == NULL )
{
printf("cannot open the outfile\n");
exit(0);
}
while(1)
{
ch = fgetc(fp_in);
if( feof(fp_in) ) //feof function returns "non_zero" when fp overflows in file,that is,
break; //if fp is located in the end of file and fp moves to next element
fputc( ch, fp_out );//again,then fp overflows.
}
fclose(fp_in);
fclose(fp_out);
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -