编写的test.c到底是个什么东西?
是不是在test.c里声明过了,include后就不用声明了?
是不是在test.c里声明过了,include后就不用声明了?
2016-03-01
#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;
}
举报