🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #386

Re: C program to download chars to printer, help needed

#386
From: John Weeks
Date: Thu, 03 May 1990 17:44
40 lines
2441 bytes
In article <5883.263c08cb@uwovax.uwo.ca> chet@uwovax.uwo.ca writes:
>Am trying for the first time to download characters to my Star NX-1000
>printer, and it is not going very well. Can anyone send me an alternative
>(in C) or suggest what I am doing wrong?
>
>char
>draft[] = {27, 'x', 0},  /* selects draft quality */
>standard[] = {27, ':', 0, 0, 0},    /* copies standard chars from ROM to RAM */
                        ^  ^
You are sending binary zeros here, where you want to send "escape, colon,
character zero, character zero, null terminator (binary zero)".  The first
'0' in your initializer is the null terminator when you send the string.
what you want is:

 	draft[] = {27,':','0','0',0}
or
	draft[] = {27,':',48,48,0}
or many other variations on the theme.  The main point is that the control
strings for the printer are specified in terms of characters.  You can
represent the characters in a variety of ways: character literals (':'),
ascii codes (48 for '0', 27 for the escape character ... ).  If you are
using an editor that lets you insert control characters in the text, you
can use quoted strings ("->:00") (the escape shows as a single character
right arrow, as I recall, in the eight bit ascii set on a PC.)  Note
that when you use quoted strings the zeros are characters and the null
terminator is provided for you.

>engma[] = {27,'&',0,181,181,138,124,0,64,1,64,1,66,60,0,0,0}
       Here too:   ^                 ^                 ^ ^
>eth[] = {27, '&',0,182,182,10,160,4,74,160,18,12,0,0,0,0},
       Also here: ^                               ^ ^ ^
>car[] = {27, '&',  0, 60, 60,139,124,0,66,4,64,36,16,2,16,12,0},
       And here:    ^                 ^
>download[] = {27, '%', 1};	/* select draft download chars */

-- 

John Weeks                                    Phone:  (402) 291-8300
Sterling Software IMD            e-mail: uunet!ssbell!weeks
1404 Ft. Crook Rd. South         e-mail: weeks@ssbell.IMD.Sterling.COM
Technical Details
Message-ID: <691@ssbell.IMD.Sterling.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!jarthur!uunet!ssbell!weeks
References: <5883.263c08cb@uwovax.uwo.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!jarthur!uunet!ssbell!weeks
From: weeks@ssbell.IMD.Sterling.COM (John Weeks)
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Re: C program to download chars to printer, help needed
Message-ID: <691@ssbell.IMD.Sterling.COM>
Date: 3 May 90 17:44:55 GMT
References: <5883.263c08cb@uwovax.uwo.ca>
Organization: Sterling Software IMD, Bellevue, NE.
Lines: 40