Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com From: Lasse Subject: Re: Trouble Sending Printer Codes from Perl to Printer Date: Fri, 01 Jul 2005 01:48:28 +0200 Lines: 28 Message-ID: References: <42C48248 DOT 4090404 AT igc DOT org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) In-Reply-To: <42C48248.4090404@igc.org> X-IsSubscribed: yes David Vergin wrote: > I'm adapting a working linux program to cygwin. The process has been > relatively painless except for this issue which has delayed me way past > deadline. > > I need to output text and printer codes (which may include \000) from a > perl program to a printer which may be on a parallel port or a USB port. > In the past I have done this on linux using something like the following. > > system(qq/echo -en "$data_str" | lpr -oraw/); > ...or whatever > > That does not work in cygwin. It would work. But on cygwin echo behaves > differently in a perl system() command from the way it works from the > bash command line. Why would want use echo for this? Just use a piped open directly to lpr: open(FH, '| lpr -oraw'); print(FH, $data_str); close(FH); (Error handling left as an exercise to the reader...) See also: http://www.google.com/search?q=perl+piped+open -- /Lasse -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/