How can I send the null character to the printer?

John Passaniti John.Passaniti at f201.n260.z1.FIDONET.ORG
Tue Sep 25 00:38:52 AEST 1990


 > From: bmyers at garnet.berkeley.edu (Brian Myers)
 >
 > In order to define some downloadable characters for my
 > dot matrix printer, I have to send it a series of
 > character values encoding the bit patterns for the new
 > characters.  Some of those encoded values are zero.  Of
 > course if I send a string like "\x00\x20\xF3" to stdprn
 > with a function like fputs, nothing gets sent, because
 > the first \x00 is interpreted as the end of the string.
 > Do I need to do a direct bios call (bios_printer)?
 > I can certainly manage that, but I just wondered if I
 > was missing some more obvious solution within the more
 > standard C functions...

     First, if you haven't already, you'll probably want to 
make sure the stdprn stream is opened in binary mode.  I 
believe by default it is in text mode.  Maybe not-- I don't 
remember.

     Second, you'll probably want to use a function like 
fwrite() to download the characters to the printer. 
fwrite() will take a count of how many bytes to send from a 
buffer; it doesn't use any embedded zeroes to determine 
where to stop.

     Hope it helps.


--  
*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*
John Passaniti - via FidoNet node 1:260/230
UUCP: ...!rochester!ur-valhalla!rochgte!201!John.Passaniti
INTERNET: John.Passaniti at f201.n260.z1.FIDONET.ORG
*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*



More information about the Comp.lang.c mailing list