#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *file;
char *filename = "./fopen.txt";
char buffer[1024];
size_t bytesRead;
file = fopen(filename,"rb");
if (file == NULL) {
perror("错误的文件");
return EXIT_FAILURE;
}
while ((bytesRead = fread(buffer, sizeof(char), sizeof(buffer), file)) > 0)
{
fwrite(buffer, sizeof(char), bytesRead, stdout);
}
fclose(file);
return EXIT_SUCCESS;
}
11-04
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交