Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 26th, 2003, 08:12 AM
Authorized User
 
Join Date: Dec 2003
Location: Bristol, , United Kingdom.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default stdprn

I'm a beginner with RedHat Linux and am converting an old Unix C program.
All went well until I got to 'stdprn' there seems no equivalent!

How to I direct fprintf(stdprn, "%s\n", "HELP!");
to my printer ???

Georges
__________________
Georges
Reply With Quote
  #2 (permalink)  
Old January 18th, 2004, 08:41 PM
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Geroges,

"I'm a beginner with RedHat Linux and am converting an old Unix C program.
All went well until I got to 'stdprn' there seems no equivalent!

How to I direct fprintf(stdprn, "%s\n", "HELP!");
to my printer ???

Georges"

Try here: http://forums.devshed.com/archive/42/2003/7/3/58719

They say...

"For what OS and with what printer are you wanting to do this? Basically, you are talking about dealing with a device, so device drivers will be involved. How you work with a device driver can also be OS-dependent. Actually, one of the great ideas of Windows (regardless of where MS stole^H^H^H^H^Hresearched it from) is to present the printer to the application as a generic printer with a set of capabilities, then translate that to the actual codes that the printer needed. In the good old days of DOS, your application had to handle all that itself, so you had to learn what the control codes and syntax were for all the printers out there -- plus, when a new printer came out, then your program was instantly obsolete and had to be updated. Windows removed that burden from programmers. Now, a cheap and dirty approach under DOS would be to fprintf to lpt1 or prn (it's been so long, I forget the printer port's name within a program, but you get the idea). Under Linux, you could pipe the stdout output to lpr or call lpr from within the program (eg, with system or output the data to a temporary file, then fork and exec lpr with that filename). In Windows, there are API calls to handle printing. I just forget what they are." - dwise1_aol

Bolds mine.

Hope that helps,

Adrian

Reply With Quote
  #3 (permalink)  
Old January 19th, 2004, 02:55 AM
Authorized User
 
Join Date: Dec 2003
Location: Bristol, , United Kingdom.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

 Adrian, thanks for that info. This is a simple DOS program
no drivers involved as it transmits direct to an old
dot-matrix Epson printer. The program sends all the
necessary escape codes etc. I'll try the two suggestions,
maybe a pipe to lpr would be the easiest. Not sure how to do that
but will experiment - a line or two of code would help if you have time!

best wishes.

Georges
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off




All times are GMT -4. The time now is 08:41 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.