home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20085 < prev    next >
Encoding:
Internet Message Format  |  1993-01-23  |  1.4 KB

  1. Path: sparky!uunet!olivea!hal.com!darkstar.UCSC.EDU!cats.ucsc.edu!banshee
  2. From: banshee@cats.ucsc.edu (Wailer at the Gates of Dawn)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How do you read binary data piped into stdin?
  5. Keywords: stdin, redirection, binary data
  6. Message-ID: <1jpk1mINN4f5@darkstar.UCSC.EDU>
  7. Date: 22 Jan 93 20:05:10 GMT
  8. References: <N0gRXB1w165w@eastwind.mcds.com>
  9. Organization: University of California, Santa Cruz
  10. Lines: 19
  11. NNTP-Posting-Host: am.ucsc.edu
  12.  
  13.  
  14. chorn@eastwind.mcds.com (Christopher Horn) writes:
  15. >I'm relatively new to C, so still have a lot to learn, so I apologize
  16. >if this is a silly question. I need to read raw binary data from
  17. >stdin (it is being piped in) but it appears stdin operates in text
  18. >mode. The first ascii 26 that comes along triggers end of file, and
  19. >I can't read the rest of the data. Could someone please explain, or
  20. >better yet show me a short peice of code, that could do this? The
  21. >answer is probably obvious, but it eludes me at the moment. Thanks
  22. >a lot!
  23.  
  24. Basically I'd think you'd want to close fd 0 (stdin) and open a new input
  25. in a binary mode.  Difficulty will differ depending on the system you're on.
  26.  
  27. -- 
  28. The Wailer at the Gates of Dawn              | banshee@cats.UCSC.EDU       |
  29. Just who ARE you calling a FROOFROO Head?    |                             |
  30. DoD#0667  "Just a friend of the beast."      | banshee@ucscb.UCSC.EDU      |
  31. 2,3,5,7,13,17,19,31,61,89,107,127,521,607....| banshee@ucscb.BITNET        |
  32.