home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!ftpbox!mothost!merlin.dev.cdx.mot.com!fendahl.dev.cdx.mot.com!mcook
- From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
- Subject: Re: Help with named pipes
- Message-ID: <mcook.713657379@fendahl.dev.cdx.mot.com>
- Sender: news@merlin.dev.cdx.mot.com (USENET News System)
- Nntp-Posting-Host: fendahl.dev.cdx.mot.com
- Organization: Motorola Codex, Canton, Massachusetts
- References: <3310@ra.nrl.navy.mil> <1992Aug12.162224.3119@rock.concert.net> <1992Aug12.163401.5091@news.eng.convex.com> <1992Aug12.192105.5316@rock.concert.net>
- Date: Wed, 12 Aug 1992 22:09:39 GMT
- Lines: 29
-
- cole@concert.net (Derrick C. Cole) writes:
-
- >if (-p $pipe) {
- > open(FIFO, "$pipe") || die "can't open\n";
- > while (<FIFO>) {
- > read(FIFO, $buf, 120);
- > chop($buf);
- > print "|$buf|\n";
- > }
- >}
-
- The <FIFO> expression is going to read a newline-terminated line from <FIFO>.
- That's probably not what you want...
-
- >Now, 120 is an arbitrary number out of the air. What I'd really like is for
- >read() to place in $buf a null-terminated string as written by the other end,
- >and not just 120 characters. Am I completely blind, is there a way to do
- >this, neither, or both?
-
- How about this:
-
- $/ = "\000"; # the input record separator
- while (<FIFO>)
- {
- chop; # discard the \0
- print "|$_|\n";
- }
-
- Michael.
-