fs.c 593 B

1234567891011121314151617181920212223242526
  1. /* -*- mode:c; c-file-style:"k&r"; c-basic-offset: 4; tab-width:4; indent-tabs-mode:nil; mode:auto-fill; fill-column:78; -*- */
  2. /* vim: set ts=4 sw=4 et tw=78 fo=cqt wm=0: */
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <errno.h>
  7. #include <unistd.h>
  8. #include <fcntl.h>
  9. int main() {
  10. int fd = open("test.open.file", O_CREAT | O_RDWR, S_IRWXU);
  11. int fd2 = open("fs.manifest", O_RDONLY);
  12. char * buf = malloc (4096);
  13. int ret;
  14. while ((ret = read(fd2, buf, 4096)) > 0) {
  15. write(1, buf, ret);
  16. write(fd, buf, ret);
  17. }
  18. close(fd);
  19. }