[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Learning C
>I must admit, stdprn and stdaux are new to me. A quick check with my
>co-workers (all of us are C or C++ programmers) and no one knows about
>stdprn or stdaux. It may be that we're all terribly ignorant *OR* it could
>be one of those "standards" that really isn't. Off the top of my head I
>can't tell you how to print to a printer. I guess you'd want to interface
>with lpd, but that wouldn't be as non-trivial as a stdprn.
You would use the popen to create a sub-process ala:
command_string = sprintf("/usr/bin/lpr -P%s", $queue_name);
FILE *printer = popen(command_string, "w");
fwrite(pointer_to_stuff, size_of_stuff, 1, printer);
pclose(printer);
(Note: the above syntax is a rough idea and in no way will compile).
Since the pclose function does not return until the subprocess
closes it's stdin (i.e. dies) you really should perform such
operations as printing in thier own thread so as not to block
over-all program execution. pclose returns the exit status of
the subprocess.
Systems and Network Administrator
Morrison Industries
1825 Monroe Ave NW.
Grand Rapids, MI. 49505