Ask Your Question
2

Redirect program output to my usb printer

asked 2012-02-14 10:05:22 -0500

Dieter gravatar image

Hello

I'm using Fedora 16 with a Brother DCP-150C printer connected via USB. Ich have absolutely no problems printing any document or text file via LibreOffice or Gedit. But, as soon as I try to redirect program output from any C program to my connected printer as follows

./myprog > /dev/usb/lp0

then nothing happens. Instead I get a 'bash: /dev/usb/lp0: Permission denied' message. Note that /dev/usb/lp0 is the device my printer is connected to.

Can anybody tell me please what I'm doing wrong or what do I should do that program redirection works on my machine.

Thank you in advance for your help.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-02-14 14:27:32 -0500

ztank1013 gravatar image

Here you will find interesting command line printing techniques and options:

http://www.cups.org/documentation.php/options.html

edit flag offensive delete link more
0

answered 2012-02-14 13:32:25 -0500

Peter Scott gravatar image

You have to use the lp command to send to the printer device. Using a pipe is easiest.

That is:

$ ./myprog | lp
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-02-14 10:05:22 -0500

Seen: 973 times

Last updated: Feb 14 '12