🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: how to print a string directly to a printer using "fprintf" or "printf" ?

#14692
From: Richard Yu
Date: Wed, 06 Aug 2003 21:02
39 lines
2249 bytes
My printer is a network printer, I tried this code,

char *PortName="IP_192.168.0.55 ";
   FILE *Printer=fopen(PortName,"wb");
   fprintf(Printer,"Text:\r\n\n","test string ");

it didn't do any thing , don't know why.

"Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message
news:3f315101$1@newsgroups.borland.com...
>
> "Richard Yu" <richard@colorselector.com> wrote in message
> news:3f314de8@newsgroups.borland.com...
>
> > in console application, printf sends the string to screen
>
> That is not entirely accurate.  The printf() function sends the string to
> STDOUT.  If you happen to run the application from a command prompt
without
> any redirection, then the console screen will be the STDOUT.  If, however,
> you run the application and redirect its output to somewhere else, then
> STDOUT will go to that new destination, ie:
>
>     // outputs to the console screen
>     C:\>  myapp
>
>     // outputs to the standard printer
>     C:\>  myapp > prn
>
> > how can I send them to printer ?
>
> If you want to output to the printer regardless of redirection, then
you'll
> just have to access the printer directly.
>
>
> Gambit
>
>
Technical Details
Message-ID: <3f316dd1$3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.gamma.ru!Gamma.RU!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f314de8@newsgroups.borland.com> <3f315101$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,ff83352b6b456ff2
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-06 14:12:02 PST
From: "Richard Yu" <richard@colorselector.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f314de8@newsgroups.borland.com> <3f315101$1@newsgroups.borland.com>
Subject: Re: how to print a string directly to a printer using "fprintf" or "printf" ?
Date: Wed, 6 Aug 2003 14:02:56 -0700
Lines: 41
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 24.207.7.224
Message-ID: <3f316dd1$3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1060203985 24.207.7.224 (6 Aug 2003 14:06:25 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.gamma.ru!Gamma.RU!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail