Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #14363

Re: How do you access the printer in Linux/C?

From Tim Watts <tw_usenet@dionic.net>
Newsgroups comp.os.linux.misc
Subject Re: How do you access the printer in Linux/C?
Date 2015-04-07 04:23 +0100
Message-ID <b6vbvb-itu.ln1@squidward.dionic.net> (permalink)
References <e26c3cbd-0f45-4069-b449-423c5759573c@googlegroups.com>

Show all headers | View raw


On 07/04/15 01:07, pureheart@pacbell.net wrote:
> Might really be a programming question.

It's more of an OS question.

The general answer to "without going through lpr" is "don't try".

Printers may be presented in a dozen different ways and speak one of 
several languages and dialects.

eg:

you could have a directly attached serial printer on /dev/ttyS? or a 
centronics printer on /dev/lp? or a USB printer on /dev/somerandomname

All of these you could at least fopen() and fprintf() to.

Then you have networked attached printers that could speak (usually over 
TCP) raw-bytes-stream, lpd protocol, ipp protocol or others.

In all cases the printer might accept ACSII and do something reasonable.

It might understand postscript or ESC/P or some other funky language.


Personally, if you must, then generate postscript, as most print 
subsystems (eg CUPS) will be able to interpret that even if the printer 
can't.

You might as well also go for the traditional unix way and just shove 
your output to STDOUT and let the user pipe it to the print clien tof 
choice, which might be lp or gtklp or a load of other possibles.


The print subsystems (either CUPS or even LPRng) do a way better job of 
driving printers than any one man could ever hope to achieve - the nasty 
stuff is best left to them.


Unless you have a very special embedded system with a fixed type of 
printer and cannot afford to have  afull print daemon running?

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How do you access the printer in Linux/C? pureheart@pacbell.net - 2015-04-06 17:07 -0700
  Re: How do you access the printer in Linux/C? Tim Watts <tw_usenet@dionic.net> - 2015-04-07 04:23 +0100
    Re: How do you access the printer in Linux/C? The Natural Philosopher <tnp@invalid.invalid> - 2015-04-07 05:46 +0100
    Re: How do you access the printer in Linux/C? floyd@apaflo.com (Floyd L. Davidson) - 2015-04-07 02:16 -0800
      Re: How do you access the printer in Linux/C? Tim Watts <tw_usenet@dionic.net> - 2015-04-07 11:30 +0100
        Re: How do you access the printer in Linux/C? The Natural Philosopher <tnp@invalid.invalid> - 2015-04-07 11:51 +0100
          Re: How do you access the printer in Linux/C? floyd@apaflo.com (Floyd L. Davidson) - 2015-04-07 03:11 -0800
            Re: How do you access the printer in Linux/C? The Natural Philosopher <tnp@invalid.invalid> - 2015-04-07 12:37 +0100
              Re: How do you access the printer in Linux/C? pureheart@pacbell.net - 2015-04-07 08:31 -0700
          Re: How do you access the printer in Linux/C? Tim Watts <tw_usenet@dionic.net> - 2015-04-07 12:24 +0100
        Re: How do you access the printer in Linux/C? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2015-04-07 16:26 +0000
      Re: How do you access the printer in Linux/C? The Natural Philosopher <tnp@invalid.invalid> - 2015-04-07 11:46 +0100
      Re: How do you access the printer in Linux/C? Unknown <dog@gmail.com> - 2015-05-06 08:50 +0000
        Re: How do you access the printer in Linux/C? Joe Beanfish <joebeanfish@nospam.duh> - 2015-05-06 13:36 +0000
          Re: How do you access the printer in Linux/C? Unknown <dog@gmail.com> - 2015-05-08 10:44 +0000
            Re: How do you access the printer in Linux/C? Joe Beanfish <joebeanfish@nospam.duh> - 2015-05-08 13:51 +0000
              Re: How do you access the printer in Linux/C? William Unruh <unruh@invalid.ca> - 2015-05-08 14:58 +0000
                Re: How do you access the printer in Linux/C? Joe Beanfish <joebeanfish@nospam.duh> - 2015-05-11 13:24 +0000
                Re: How do you access the printer in Linux/C? Robert Heller <heller@deepsoft.com> - 2015-05-11 14:40 -0500
            Re: How do you access the printer in Linux/C? William Unruh <unruh@invalid.ca> - 2015-05-08 14:55 +0000
  Re: How do you access the printer in Linux/C? The Natural Philosopher <tnp@invalid.invalid> - 2015-04-07 05:43 +0100
  Re: How do you access the printer in Linux/C? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-04-07 12:15 -0400
    Re: How do you access the printer in Linux/C? pureheart@pacbell.net - 2015-04-09 15:39 -0700

csiph-web