home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / msdos / programm / 12401 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  1.2 KB

  1. Path: sparky!uunet!stanford.edu!agate!darkstar.UCSC.EDU!cats.ucsc.edu!spencer
  2. From: spencer@cats.ucsc.edu (Michael Spencer)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: tee for DOS?
  5. Date: 24 Jan 1993 18:55:01 GMT
  6. Organization: University of California, Santa Cruz
  7. Lines: 28
  8. Message-ID: <1juom5INNgak@darkstar.UCSC.EDU>
  9. References: <1993Jan22.184439.27754@magnus.acs.ohio-state.edu>
  10. NNTP-Posting-Host: am.ucsc.edu
  11.  
  12.  
  13.  
  14. esova@magnus.acs.ohio-state.edu (Edward R Sova) writes:
  15.  
  16. >Where can I get the Unix tee command for DOS?  You can split redirection and
  17. >piping.  like maybe foo | tee > prn >logfile.  Well I'm not sure of the 
  18. >syntax, and I don't care right now, but I think you see what I want.  Where
  19. >is it?  Thanx
  20.  
  21. Roll your own. Code goes something like this:
  22.  
  23. while (! feof(stdin))  {
  24.     fgets (str, 255, stdin);
  25.     fputs (str, stderr);        // send to screen
  26.     fputs (str, stdout);        // send whereever directed
  27.     }
  28. fflush (stderr);
  29. fflush (stdout);
  30. close (dup(fileno(stdout)));        // ensure flushing on stdout
  31.  
  32.  
  33. -- 
  34.  
  35. ===========================================================================
  36. Michael Spencer            |      2640 Borregas
  37. spencer@cats.ucsc.edu      |      Aptos, CA   95003
  38. ===========================================================================
  39.  
  40.