Thank you both for your input.
I got the following solution for lpd:
pFp = popen( “lpr -P{Printer}”, “w” );
fprintf( pFp, “bla bla bla…” );
pclose( pFp );
Markus
“Bill Caroselli (Q-TPS)” <QTPS@EarthLink.net> schrieb im Newsbeitrag
news:amfpsj$r39$1@inn.qnx.com…
right. Sorry.
“Richard Kramer” <> rrkramer@kramer-smilko.com> > wrote in message
news:> 3D8A3120.9D347132@kramer-smilko.com> …
“Bill Caroselli (Q-TPS)” wrote:
In C you can open /dev/spool/{printer} and start writing. When you
close
There is no /dev/spool when using lpd and not lpsrvr.
Richard
the file it starts printing.
That’s all you need.
Obviously from shell you can:
myprog > /dev/spool/{printer}
too.
“Richard Kramer” <> rrkramer@kramer-smilko.com> > wrote in message
news:> 3D88B882.741B9000@kramer-smilko.com> …
Markus Jauslin wrote:
“Richard Kramer” <> rrkramer@kramer-smilko.com> > schrieb im
Newsbeitrag
news:> 3D876A48.5DD0495B@kramer-smilko.com> …
Markus Jauslin wrote:
Hi all
I have to print from code to a spooler. Inour normal setup the
printers
are
connected directly to the system under tight control. Now for
a
special
application the spooler should replace the serial driver where
the
propriatary print stream is transmitted to.
- Setup of native QNX Spooling facility
Is the following the correct way to do it:
fp = fopen( “/dev/spool/{printer}”, “w” );
fwrite( data, sizeof( byte ), lgt, fp );
fclose( fp );
A further question is: Do I have to close again to submit the
job or
can something else be sent to the spooler?
Nothing will come out of “the other end” of the spooler until
you
close
fp as above. Each open/write/close is a separate job, which
means
that
if another process sends to the same printer before you have
finished
all your jobs, the jobs will be intermingled by the printer.
Thanks for your confirmation.
2) Setup of TCP/IP Spooler
How do I address the right spooler/printer?
You are talking about lpsrvr rather than lpd, right?
“{printer}” above will be the name of a queue as defined in
/etc/config/lpsrvr. It will feed a device or another queue.
You should be able to work back from the printer to the queue by
knowing the contents of /etc/config/lpsrvr.
No I had lpd in mind. In online help coexistence of lpsrvr and lpd
is
not
recommended. There fore if a printer is connected by lan I want to
address a
“lpd spooler”.
lpr -P{printer} [other options] file
or
cat file | lpr -P{printer}
If you are doing this from a C prog and want to avoid spawn, you can
probably get away with writing the file to
/usr/spool/lpd/{printer}/,
calling it df[stuff] and also writing a a cf[stuff] file and
sincrementing .seq etc., etc. This may be documented somewhere; I
have
not tried it.
Richard
Any hints, pointers, how to’s and examples are highly
appreciated.
Thanks, Markus