delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/07/06:46:45

Date: Sun, 7 Mar 1999 13:44:40 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: David Nugent <davidn AT cbhc DOT ns DOT ca>
cc: djgpp AT delorie DOT com
Subject: Re: Help, DJGPP or ALLEGRO are doing something to printer output?
In-Reply-To: <36DFEABD.1074@cbhc.ns.ca>
Message-ID: <Pine.SUN.3.91.990307134420.26544a-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Fri, 5 Mar 1999, David Nugent wrote:

> When it goes to the printer, the printer's data 
> light flashes for a few seconds, and then the error light 
> comes on.  I originally tried sending the file to stdprn, 
> and thought this is where the problem was.

You need to switch stdprn to binary mode, if the data is binary, like
this:

	setmode (fileno (stdprn), O_BINARY);

> So then I 
> wrote the output to a file and then did a 
> "COPY /B FILENAME LPT1:"  This worked. Now if I take the 
> same file, and from within my program issue...
> 
> system ("copy /B filename LPT1:");

This should have worked (although you might lose the trailing colon,
which is not part of the printer's device name); it worked for me.
Please try to do this from a trivial one-line program, and see if that
works.  If it does, the problem is with the rest of code in the larger
program.

If the short program doesn't work either, maybe your setup sets the
SHELL or COMSPEC environment variables to something unusual.  `system'
uses these variables to decide what shell to invoke.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019