Article View: news.software.readers
Article #41166Windows 16/32 printer code for slrn
From: root
Date: Tue, 26 May 1998 00:00
Date: Tue, 26 May 1998 00:00
51 lines
1644 bytes
1644 bytes
The following sample code should work for Windows 3.x printing from
the slrn program, and will even work for Windows 95/98 printing when
used on a personal computer not connected to a network. To use this
code, insert it into slrn/src/print.c, with appropriate modifications:
#ifdef USE_WIN16_PRINT_CODE /*{{{*/
typedef struct _Slrn_Print_Type
{
FILE *fp;
int error_status;
} Slrn_Print_Type;
static Slrn_Print_Type p;
Slrn_Print_Type *win16_open_printer (void)
{
p.fp = fopen("prn", "w");
if (!p.fp)
{
p.error_status = 1;
slrn_error ("Printer not supported");
return NULL;
}
else
{
p.error_status = 0;
return (Slrn_Print_Type *)&p;
};
}
int win16_write_to_printer (Slrn_Print_Type *p, char *buf, unsigned int len)
{
char huge *p_buf = buf;
while (len--)
if (fputc(*p_buf++, p->fp) == EOF)
{
p->error_status = 1;
return -1;
};
return 0;
}
int win16_close_printer (Slrn_Print_Type *p)
{
return fclose(p->fp);
}
/*}}}*/
#endif /* USE_WIN16_PRINT_CODE */
Technical Details
Message-ID:
<6kefal$6pn$1@gte1.gte.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <6kefal$6pn$1@gte1.gte.net> Subject: Windows 16/32 printer code for slrn Date: Tue, 26 May 1998 00:00:00 +0000 From: root@gte.net () Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail X-Deja-AN: 356623087 Reply-To: vtailor@gte.net-nospam Organization: The Light X-Auth: C01F840F0D83D69650CE8491 Newsgroups: news.software.readers