home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume27 / clc / part01 / libs / src / sio / suite / example.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-28  |  569 b   |  28 lines

  1. /*
  2.  * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  3.  * All rights reserved.  The file named COPYRIGHT specifies the terms 
  4.  * and conditions for redistribution.
  5.  */
  6.  
  7. static char RCSid[] = "$Id: example.c,v 8.1 1993/03/13 01:21:48 panos Exp $" ;
  8.  
  9. #include "sio.h"
  10.  
  11. main( argc, argv )
  12.    int argc ;
  13.    char *argv[] ;
  14. {
  15.    char *file = (argc > 1) ? argv[ 1 ] : "tee.file" ;
  16.    int fd = creat( file, 0644 ) ;
  17.    long length ;
  18.    char *s ;
  19.  
  20.    while ( s = Sfetch( 0, &length ) )
  21.    {
  22.       Swrite( 1, s, length ) ;
  23.       Swrite( fd, s, length ) ;
  24.    }
  25.    exit( 0 ) ;
  26. }
  27.  
  28.