Article View: borland.public.cppbuilder.nativeapi
Article #8535Re: Printing to LPT1
From: Stuart Borden
Date: Mon, 11 Oct 2004 07:22
Date: Mon, 11 Oct 2004 07:22
33 lines
1739 bytes
1739 bytes
On Fri, 8 Oct 2004 21:07:29 -0400, "mike" <mfbrowne@earthlink.net> wrote:
>I am wondering if someone could tell me why this code does not send anything
>to the printer I have attached to the lpt1 port.
>
>char buff[100];
>
>strcpy(buff,"Test");
>
> FILE *ptr = fopen("LPT1","w");
>fprintf(ptr,buff);
>fclose(ptr);
>
>If I use a windows printer then I can send data to the printer. However this
>is a receipt printer and I just want to use the lpt1 port directly. Do I
>have to do something to the lpt1 port before I send any data.
>
>Thanks for any information
>
>Mike
>
Try this:
fprintf(ptr, "%s\n\f", buff);
Most printers won't print until they know they have something to print. This
means:
1. Line printers wait for EOL (CR or CR/LF)--------------"\n"
2. Page printers (laser, inkjet) wait for EOP (FF)------"\f"
Stuart B.
Technical Details
Message-ID:
<2vckm0h5tir7cemtb5d6laa9kajbiuhr3u@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<41673a45$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,facf9d1b2fa86ea6 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Stuart Borden <sborden@spectrontech.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Printing to LPT1 Date: Mon, 11 Oct 2004 16:22:46 +0900 Message-ID: <2vckm0h5tir7cemtb5d6laa9kajbiuhr3u@4ax.com> References: <41673a45$1@newsgroups.borland.com> X-Newsreader: Forte Free Agent 2.0/32.652 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 61.42.125.14 X-Trace: newsgroups.borland.com 1097479288 61.42.125.14 (11 Oct 2004 00:21:28 -0700) Lines: 33 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail