Path: utzoo!attcan!uunet!samsung!usc!ucsd!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: Problem piping binary data Message-ID: <1990Jul17.185534.15629@iwarp.intel.com> Date: 17 Jul 90 18:55:34 GMT References: <8120@pitt.UUCP> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 34 In-Reply-To: al@ee.pitt.edu (Alan Martello) In article <8120@pitt.UUCP>, al@ee (Alan Martello) writes: | I give up. I want to pipe binary data from one program to another | while (possibly) filtering it. | | Why doesn't this work and how can it be modified to work? | | ------------------------------------------------------------------------ | open(TMPFH,"cat /vmunix | "); | open(OUTFH, "| dd of=./vmunix_copy2"); | | while() | { | printf OUTFH $line; | read(TMPFH, $line, $length); | } | | close(OUTFH); | close(TMPFH); The "printf" is your culprit. It's probably eating every single %-escape and null character in the string. Replace that with print OUTFH $line and you'll be able to sleep at night. I know I do. :-) printf "%c%c%c%c%s",ord("J"),ord("u"),ord("s"),ord("t")," another Perl hacker," -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/