// ... the usual includes ... // the named pipe (or fifo) called channel must be // created (using the mkfifo command or the mkfifo() // system function) before this program is run. // the reading and writing programs must run at the // same time. char * s[] = { "one two three four\n", "five six\n", "seven eight nine ten\n", "eleven\n", NULL }; int main() { int r, i, f = open("channel", O_WRONLY); if (f < 0) { perror("w open"); exit(1); } for (i = 0; 1; i += 1) { if (s[i] == NULL) break; r = write(f, s[i], strlen(s[i])); printf("w %d\n", r); } close(f); }