next up previous contents
Next: About this document ... Up: Echo: A User Application Previous: Overview

Source Listing

/* echo.c -- Copyright 1988, 1999 Sandia National Laboratories */

/* test reading and writing to STDIN and STDOUT */
#include <unistd.h>

#define BUFSIZE 100

int main() {
  char buf[BUFSIZE];
  int n;
  while ((n = read(STDIN_FILENO,buf,BUFSIZE)) > 1)
     write(STDOUT_FILENO,buf,n);
  return 0;
}



James Otto
1999-01-26