/* * CS360: cat2.c * Jim Plank */ #include #include void *inout(void *v) { int *fds; int i; char s[1000]; fds = (int *) v; while(1) { i = read(fds[0], s, 1000); if (i == 0) return NULL; write(fds[1], s, i); } } main() { pthread_t tid; void *retval; int fds[2]; fds[0] = 0; fds[1] = 1; pthread_create(&tid, NULL, inout, fds); pthread_join(tid, &retval); }