main
parent
cd72b1fdaa
commit
4ce305a938
@ -0,0 +1,22 @@
|
||||
#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;
|
||||
}
|
||||
|
Loading…
Reference in new issue