>> C_PLUSPLUS <<
Wednesday, October 15, 1997
Hello Darrell!
As follows:
ofstream printer;
printer.open("LPT1");
printer << endl << endl << endl<< endl;
Do NOT, repeat NOT, close a printer by
printer.close();
Your printer can NOT be opened again, you have to restart your
computer.
In the same way you can write some printercodes (EPSON)
to your printer:
//----------------------------------------------------------------------------
-
// testing: is printer online?
//----------------------------------------------------------------------------
-
int online_prn(void)
{
unsigned status;
_asm {
mov dx,0 // 0 = LPT1, 1 = LPT2
mov ax,2
int 17h
mov status,ax
}
if(status == 0x1002)
return TRUE;
else
return FALSE;
}
//----------------------------------------------------------------------------
-
// set printers left margin
//----------------------------------------------------------------------------
-
void left_margin(int n)
{
printer.put(0x1b);
printer.put(0x58);
printer.put(n);
printer.put(136);
}
//----------------------------------------------------------------------------
-
// set printer to Emphasized
//----------------------------------------------------------------------------
-
void emphasized(void)
{
if(!online_prn()) {
cout << " printer NOT online" << endl;
return;
}
printer.put(0x1b);
printer.put(0x45);
//----------------------------------------------------------------------------
-
// set printer to Elite Double Strike
//----------------------------------------------------------------------------
-
void elite(void)
{
if(!online_prn()) {
cout << " printer NOT online" << endl;
return;
}
printer.put(0x18);
printer.put(0x1b);
printer.put(0x21);
printer.put(0x11);
}
Tuesday, October 14, 1997, Darrell Hnizdor writes to All:
DH> How is output redirected to a printer?
DH> I would like to be able to print!
DH> -+- Maximus 3.01
DH> + Origin: Friendship Corner Albany, Tx 1-915-762-2745 (1:392/15)
Regards, Henk
E-mail: hdeutekom@bundy.idn.nl
--- FMail/386 1.02+ & GoldED/386 2.50+
---------------
* Origin: Henk's point, The Netherlands (2:283/6.22)
|