home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
print
/
hplist
/
hpreset.c
< prev
next >
Wrap
Text File
|
1994-02-03
|
2KB
|
54 lines
/***
*
*
* hpreset.c
*
* Sends the HP PCL printer reset command to the printer.
*
* Receipt of the printer reset command by the HPLJ II restores the user
* default environment, deletes temporary fonts and macros, and prints
* any partial pages of data which may have been received.
*
* Hewlett-Packard strongly recommends the use of the printer reset
* command at the beginning and end of each job.
*
* This program written by W. A. Jackson and dedicated to the public domain.
*
*****************************************************************************/
#define INCL_BASE
#include <OS2.H>
#include <stdio.h>
#include <fcntl.h>
#include <sys\types.h>
#include <sys\stat.h>
#include <io.h>
main()
{
int print_handle; /* file handle for printer */
FILE *print_pointer; /* stream for printer */
/*
* Note: this is an awkward way to open a stream to the printer,
* but necessary to work around a bug in Microsoft C Ver. 5.1
*
*************************************************************************/
print_handle = open ("PRN", O_WRONLY); /* open file handle */
if (print_handle == -1) /* test for open error */
perror ("open failed on PRN");
print_pointer = fdopen (print_handle, "w"); /* associate stream */
if (print_pointer == NULL) /* test for error */
perror ("fopen failed on print_handle");
fprintf (print_pointer, "\x01BE"); /* send Esc E (reset) */
if (fclose (print_pointer) == EOF) /* close stream */
perror ("fclose failed on print_pointer"); /* test for error */
printf ("Laserjet reset."); /* display message */
}