Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Unknown Newsgroups: comp.os.linux.misc Subject: Re: How do you access the printer in Linux/C? Date: Wed, 6 May 2015 08:50:56 +0000 (UTC) Organization: A noiseless patient Spider Lines: 43 Message-ID: References: <87lhi4b5uv.fld@barrow.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 6 May 2015 08:50:56 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="e431ee5e694299acda8def01c8e1c521"; logging-data="12005"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/g1gAbD/nrE0JKN20XUYxxKIscGJAccrQ=" User-Agent: Pan/0.133 (House of Butterflies) Cancel-Lock: sha1:0HXWLDn3gmOcQugxBCuAfHBdK3g= Xref: csiph.com comp.os.linux.misc:14718 On Tue, 07 Apr 2015 02:16:56 -0800, Floyd L. Davidson wrote: > Tim Watts wrote: >>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". > > That needs to be emphasised. It should say: > > *"Don't even think about it! Ever!"* > > CUPS, or another print spooler, is there for a good reason, and normal > users on a multi-user multi-tasking system should never directly access > hardware such as a printer. > > Piping a file into lp or lpr using system() is one way, and it works > relatively well. Using popen() to access the spooler, and then fprint() > to send it the data without writing it to a file, is a much better way. If the office M$ system was closed for 2 weeks, and you needed to desperately print some files from your portable *nix computer via the office-HP-3055-Laser-Jet, how would you drive the printer via an eth0 cable from your portable? What's a simple script to probe the printer to find its IP? Can nc do that? You've previously always just given your text-files to the M$-user on a USBstik, so you've never setup `cups` etc. on a computer, and you want to be able to just plug in your ethO cable and call a single script, and not need to work at the inconveniently located printer. How to simplify even further, so that the portable device, that brings the files to the eth0 connected printer, has no display/kybrd, and is just programmed to . No that's not fantacy : it's been playing flawlessly, when powered-up 1000 times. ==TIA.