[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

    PWrite -- internal write to printer port

    error = (*PrinterData->pd_PWrite)(buffer, length);
    D0                                  A0      D0

    PWrite writes 'length' bytes directly to the printer.  This
    function is generally called by printer drivers to send
    their buffer(s) to the printer.

    This function is accessed by referencing off the PrinterData (PD)
    structure.  Below is a code fragment to show how to do get access
    to a pointer to the PrinterData (PD) structure.

    #include <exec/types.h>
    #include <devices/printer.h>
    #include <devices/prtbase.h>

    struct IODRPReq PReq;
    struct PrinterData *PD;
    struct PrinterExtendedData *PED;

    /* open the printer device (any version); if it opened... */
    if (OpenDevice("printer.device", 0, &PReq, 0) == NULL) {

        /* get pointer to printer data structure */
        PD = (struct PrinterData *)PReq.io_Device;

        /* write something directly to the printer */
        (*PD->pd_PWrite)("Hello worldn", 12);

        CloseDevice(&PReq); /* close the printer device */

[Back to Amiga Developer Docs]