You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
466 B
23 lines
466 B
#include<fcntl.h>
|
|
#include<sys/types.h>
|
|
#include<unistd.h>
|
|
#include<sys/stat.h>
|
|
#define LEN 512
|
|
int main(int argc, char** argv) {
|
|
int f1, f2, f3, n = 0;
|
|
char buf[520], ch = '\n';
|
|
f1 = open(argv[1], O_RDWR);
|
|
f2 = open(argv[2], O_RDWR);
|
|
f3 = open(argv[3], O_CREAT | O_RDWR);
|
|
while ((n = read(f1, buf, LEN)) > 0)
|
|
write(f3, buf, n);
|
|
write(f3, &ch, 1);
|
|
while ((n = read(f2, buf, LEN)) > 0)
|
|
write(f3, buf, n);
|
|
close(f1);
|
|
close(f2);
|
|
close(f3);
|
|
return 0;
|
|
}
|
|
|