[comp.lang.c] Printer control with Turbo-C

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

This was a contribution for comp.lang.pascal :

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


*****************************************************************************
Stefan         st%trillian.irb@unido.UUCP
Timphus        st@trillian.irb.informatik.uni-dortmund.de
               Phone: +49 +231 755 4663
*****************************************************************************