Raw mode on lp - Help!

Kevin D. Quitt kdq at demott.COM
Fri Oct 12 03:54:43 AEST 1990


    I need to dump out a file to the printer, which file contains
characters that have the high bit set (for graphics).  I'm running on a
Motorola Delta 3600, SYSV R3V5.1.  Why doesn't the following work?

#include	<sys/lprio.h>
#include	<stdio.h>
#include	<sys/fcntl.h>

char	buffer[ 4096 ];

void main()
{
	int	lp, file, bytes;
	struct lprio	lpr;

	lp	= open( "/dev/lp147", O_WRONLY, 0600 );
	if ( lp  ==  -1 )
		exit(1);

	ioctl( lp, LPRGET, &lpr );
	lpr.ind	= 0;
	ioctl( lp, LPRSET, &lpr );

	ioctl( lp, LPRRAW, &lpr );


	file	= open( "/usr/spool/uucppublic/prntscrn", O_RDONLY, 0 );

	while ( bytes = read( file, buffer, sizeof( buffer )))
		write( lp, buffer, bytes );

	close( file );
	close( lp );
}



    Thanks in advance.



More information about the Comp.unix.programmer mailing list