bmyers@garnet.berkeley.edu (Brian Myers) (09/22/90)
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... --------------------------------------------------------------------------- Brian Myers bmyers@garnet.berkeley.edu
userAKDU@mts.ucs.UAlberta.CA (Al Dunbar) (09/22/90)
In article <1990Sep22.012947.21558@agate.berkeley.edu>, bmyers@garnet.berkeley.edu (Brian Myers) writes: >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... > > > >--------------------------------------------------------------------------- >Brian Myers bmyers@garnet.berkeley.edu fwrite( buffer, size, count, stream ); -------------------+------------------------------------------- Al Dunbar | Edmonton, Alberta | this space for rent CANADA | -------------------+------------------------------------------- #! r
kaiser@ananke.stgt.sub.org (Andreas Kaiser) (09/23/90)
`t BM> In order to define some downloadable characters for my dot matrix printer, BM> I have to send it a series of character values encoding the bit patterns BM> for the new characters. Some of those encoded values are zero. Of course BM> if I send a string like "\x00\x20\xF3" to stdprn with a function like BM> fputs, nothing gets sent, because the first \x00 is interpreted as the BM> end of the string. Make your own 'fputs', using 'putc'. 'putc' should transmit ANY code (unless you operate in text mode on a PC running MSDOS :-). Gruss, Andreas -- :::::::::::::::::::: Internet: kaiser@ananke.stgt.sub.org :: Andreas Kaiser :: Fidonet: 2:507/18.7206 (+ 2:509/5.2512) ::::::::::::::::::::
John.Passaniti@f201.n260.z1.FIDONET.ORG (John Passaniti) (09/24/90)
> From: bmyers@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@f201.n260.z1.FIDONET.ORG *%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*
jimp@cognos.UUCP (Jim Patterson) (09/25/90)
In article <15.26FC622E@ananke.stgt.sub.org> kaiser@ananke.stgt.sub.org (Andreas Kaiser) writes: >`t BM> In order to define some downloadable characters for my dot matrix printer, > BM> I have to send it a series of character values encoding the bit patterns > BM> for the new characters. Some of those encoded values are zero. > >Make your own 'fputs', using 'putc'. 'putc' should transmit ANY code (unless you >operate in text mode on a PC running MSDOS :-). ANY (faithful) implement of fputs will have the same problem. fputs is DEFINED to transmit only up to the first NUL, and so will never transmit a NUL byte by definition. However, fputc or putc will work in other contexts, as will fwrite (as someone else has already noted). -- Jim Patterson Cognos Incorporated UUCP:uunet!mitel!cunews!cognos!jimp P.O. BOX 9707 PHONE:(613)738-1440 3755 Riverside Drive Ottawa, Ont K1G 3Z4