Printer control with Turbo-C

Stefan Timphus st%trillian.irb at unido.uucp
Fri Jul 14 06:17:26 AEST 1989


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 at unido.UUCP
Timphus        st at trillian.irb.informatik.uni-dortmund.de
               Phone: +49 +231 755 4663
*****************************************************************************



More information about the Comp.lang.c mailing list