Skip to content
Snippets Groups Projects
  • rsc's avatar
    9b37d1bf
    · 9b37d1bf
    rsc authored
    Add user.h for prototypes.
    Add cons_puts for cleaner output.
    9b37d1bf
    History
    rsc authored
    Add user.h for prototypes.
    Add cons_puts for cleaner output.
user1.c 274 B
#include "user.h"

char buf[32];

int
main()
{
  int pid, fds[2], n;

  pipe(fds);
  pid = fork();
  if(pid > 0){
    write(fds[1], "xyz", 4);
    puts("w");
  } else {
    n = read(fds[0], buf, sizeof(buf));
    puts("r: ");
    puts(buf);
    puts("\n");
  }
  for(;;);
}