Martin Ambuhl <mambuhl@earthlink.net> writes:
[color=blue]
> Martin Dickopp wrote:[color=green]
>> "Isaac" <i.owusu@btinternet.com> writes:
>>[color=darkred]
>>>I have been trying to find out, in C programming language, how to send
>>>output to a printer. Can anyone help?[/color]
>> Cannot be done in *standard* C, which is the topic of this newsgroup.[/color]
>
> Sure, it can. If the printer is accessible as something with which a
> FILE * can be associated, fopen(), fprintf(), and fclose() work just
> fine. This case obtains in Windows (and DOS), Unix, and most other
> systems.[/color]
Okay, but there's no standard way to do it. IMHO, this is no different
from accessing networks, serial ports, arbitrary locations on the
screen, or "raw" keyboard input, all of which are also possible in
standard C if the device is accessible through an associated FILE *
object.
<off-topic>
On Unix at least, accessing a locally attached printer through something
which can be fopen'ed often requires special privileges, but there's a
different way to print which is also available to programs which run
without without special privileges. So using fopen to print on Unix
might at least not be the best advice for that platform.
</off-topic>
[color=blue][color=green]
>> Please ask in a newsgroup dedicated to your OS. For example, if you're
>> programming for Unix, comp.unix.programmer would be appropriate.[/color]
>
> Your advise is usually very good, but I think you overreached this time
> in the "please post elsewhere" response.[/color]
I still don't think so, but given the other replies to the OP, I concede
(with apologies to the OP) that I'm probably wrong.
Martin
--
,--. Martin Dickopp, Dresden, Germany ,= ,-_-. =.
/ ,- )
http://www.zero-based.org/ ((_/)o o(\_))
\ `-' `-'(. .)`-'
`-. Debian, a variant of the GNU operating system. \_/