Sending a file to the printer, how?

L

Lord

Hello all,

Say I have a file called "error.log" that I wish to send to the
printer. How would I print the file to the printer? I found out I can
use the SYSTEM function and send a command like

PRINT error.log

but that command is displayed on the screen which I don't want. I
would rather use some sort of c rountine if possible. I am using
Microsoft C v6.00. Any help is greatly appreciated. Thanks!!!



Mark
 
R

Richard Bos

Lord said:
Say I have a file called "error.log" that I wish to send to the
printer. How would I print the file to the printer?

I found out I can use the SYSTEM function

There is no SYSTEM function. C is case-sensitive: that function is
called system.

Richard
 
M

Martin Ambuhl

Lord said:
Hello all,

Say I have a file called "error.log" that I wish to send to the
printer. How would I print the file to the printer?


fopen the log file for input
fopen the printer
loop
read log file, if finished break
write to printer
endloop
fclose the log file
fclose the printer

remember to add appropriate error checking.
 
O

osmium

Lord said:
Say I have a file called "error.log" that I wish to send to the
printer. How would I print the file to the printer? I found out I can
use the SYSTEM function and send a command like

PRINT error.log

but that command is displayed on the screen which I don't want. I
would rather use some sort of c rountine if possible. I am using
Microsoft C v6.00. Any help is greatly appreciated. Thanks!!!

You might look into the echo command. Please restrict any follow ups to
platform oriented newsgroups, distribution trimmed.
 
S

SX001

printer. How would I print the file to the printer? I found out I can
use the SYSTEM function and send a command like

PRINT error.log

but that command is displayed on the screen which I don't want. I
but try this:

PRINT error.log >nul

or

COPY error.log PRN >nul

would rather use some sort of c rountine if possible. I am using
Microsoft C v6.00. Any help is greatly appreciated. Thanks!!!

open the outputfile as PRN (default printer port) and then you had to send
the data to the port and close it.

best greetings,
Aleksander
 
M

Malcolm

Lord said:
I would rather use some sort of c rountine if possible. I am using
Microsoft C v6.00. Any help is greatly appreciated. Thanks!!!
You need to look up "printing" in your documentation. Unfortunately ANSI C
doesn't provide any portable printer functions, and platform-specific ones
tend to be rather complex to use because they have to deal with different
types of printer, sharing the printer with other programs or machines,
different paper sizes, graphic capabilities, and so forth.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top