TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: DARRELL HNIZDOR
from: HENK DEUTEKOM
date: 1997-10-15 21:19:00
subject: Printer

                                                        >> 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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.