home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / perl / 6901 < prev    next >
Encoding:
Text File  |  1992-11-09  |  1.1 KB  |  33 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!mcsun!dxcern!dxcern!cons
  3. From: cons@mercury.cern.ch (Lionel Cons)
  4. Subject: Bug or feature ?
  5. Message-ID: <CONS.92Nov9103421@mercury.cern.ch>
  6. Sender: news@dxcern.cern.ch (USENET News System)
  7. Organization: CERN, European Research Center for Particle Physics
  8. Distribution: comp
  9. Date: Mon, 9 Nov 1992 09:34:21 GMT
  10. Lines: 21
  11.  
  12. I want to read the first two bytes of STDIN and then exec another
  13. process that uses the remaining chars from STDIN. According to the man
  14. pages the following script should work (if STDIN does not have the
  15. close-on-exec flag set):
  16.  
  17. #!/usr/local/bin/perl
  18. $c1 = getc(STDIN);
  19. $c2 = getc(STDIN);
  20. print "First chars: '$c1' and '$c2'\n";
  21. exec('/bin/wc', '-c');
  22.  
  23. It does not work (wc reply is 0), why ?
  24. --
  25.  
  26. Lionel Cons
  27.  
  28. +------- CERN - European Laboratory for Particle Physics -------+
  29. | E-mail: cons@dxcern.cern.ch                                   |
  30. | Earth-mail: CN/SW/WS, CERN, CH-1211 GENEVE 23, Switzerland    |
  31. | Phone: +41 22 767 49 13              Fax: +41 22 767 71 55    |
  32. +---------------------------------------------------------------+
  33.