Cocobit
2016-03-01 19:53
是不是在test.c里声明过了,include后就不用声明了?
#include <stdio.h>
int main() {
FILE *input1 = fopen("test1", "rb");
if (!input1) {
printf("file \"test1\" open failed!\n");
return -1;
}
FILE *input2 = fopen("test2", "rb");
if (!input2) {
printf("file \"test2\" open failed!\n");
return -1;
}
FILE *output = fopen("test", "wb");
if (!output) {
printf("file \"test\" open failed!\n");
return -1;
}
unsigned char buffer[8192];
long bytes = 0;
do {
bytes = fread(buffer, 1, sizeof(buffer), input1);
if (bytes) {
fwrite(buffer, 1, bytes, output);
}
} while (bytes == sizeof(buffer));
fclose(input1);
do {
bytes = fread(buffer, 1, sizeof(buffer), input2);
if (bytes) {
fwrite(buffer, 1, bytes, output);
}
} while (bytes == sizeof(buffer));
fclose(input2);
fclose(output);
printf("done.\n");
return 0;
}
C语言入门
926207 学习 · 20797 问题
相似问题