[comp.lang.pascal] Printer control with Turbo

st%trillian.irb@unido.uucp (Stefan Timphus) (07/14/89)

A while ago I asked how I could send Escape-codes to the printer, but
nobody could really answer that. Now while testing the same for Turbo-C 
I found the solution (at least for my printer).
This doesn't work :
T-Pascal :   write(lst,#27,'G');
             write(lst,chr(27),'G');
T-C      :   fprintf(stdprn,"%cG",27);

But try this :
T-Pascal :   write(lst,chr($1b),'G');
T-C      :   printf(stdprn,"\x1bG");
             fprintf(stdprn("%xG",0x1b);
             (also works with octals)

I hope this is interesting for some of you.
                                           Stefan
                                           st%trillian.irb@unido.UUCP

mitch@arcturus.UUCP (Mitchell S. Gorman) (07/18/89)

st%trillian.irb@unido.uucp (Stefan Timphus) writes:

>A while ago I asked how I could send Escape-codes to the printer, but
>nobody could really answer that. Now while testing the same for Turbo-C 
>I found the solution (at least for my printer).
>This doesn't work :
>T-Pascal :   write(lst,#27,'G');
>             write(lst,chr(27),'G');

>But try this :
>T-Pascal :   write(lst,chr($1b),'G');

	Or, you could simply send a bunch of byte values to the printer,
like this:	
	write(lst, #27#71);	{ Esc-G }

	I'm working an application right now that will be running with a
laser printer.  Unfortunately, I am currently the embarrassed owner of an
MX-80.  In order to test my reports. I've set up compiler directives that
define constants like this:

{$ifdef hp}
	bold=#27#<something>#<something else>;
	.
	.
	.
{$else}
	bold=#27#<whole lotta somethings!...>;
	.
	.
	.
{$endif}

	Then, the correct escape sequence will be sent depending on my
compiler directve status (hp).  TYhis works just fine.

	Mitch @ Rockwell, Anaheim

Disclaimer:	I don't _care_ if you don't care!!