🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #8621

Re: Printing to LPT1

#8621
From: Bob Gonder
Date: Sat, 09 Oct 2004 17:12
21 lines
1443 bytes
mike 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");

Open it in Binary mode  "wb"
IIRC, in the DOS days, the port was "LPT1:"
If the other changes don't fix it, try that.

>fprintf(ptr,buff);
>fclose(ptr);

Some printers won't print partial lines.
Add
fprintf(ptr,"\r\n");
Technical Details
Message-ID: <am6gm0hctvodhsq42uao3mj83eb8vncknh@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!proxad.net!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <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: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Printing to LPT1
Date: Sat, 09 Oct 2004 10:12:00 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <am6gm0hctvodhsq42uao3mj83eb8vncknh@4ax.com>
References: <41673a45$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.34.196.68
X-Trace: newsgroups.borland.com 1097341918 69.34.196.68 (9 Oct 2004 10:11:58 -0700)
Lines: 24
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!proxad.net!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail