Software Archive
Read-only legacy content
17061 Discussions

Sending output to printer

Intel_C_Intel
Employee
774 Views
I use the following method to send output directly to the printer:

OPEN(8,FILE='LPT1',CARRIAGE CONTROL='FORTRAN',IOSTAT=IS)
WRITE(8,'(1X,''BLAH'')')

where there are probably 100's of WRITE statements after the OPEN statement.

Occasionally, the printer will skip a character. This is obvious because much of my output is in columns and there's a "jog" in one line every once in a while. I use NT and I haven't noticed the problem myself, but some of the other people in our company run the same Fortran program on Windows 95 and this is where the problem seems to crop up.

I know I could use unit 6 which is preconnected to the printer, but I should explain the little code snippet above has been simplified. Actually, FILE points to a variable which can be a disk file, a network printer, 'CON' or 'LPT1'.

The problem does not occur on just one particular printer, so I don't think it's a printer problem.

Does anybody have any idea what the problem could be? Is there a better way to send output to a printer?

Thanks,

Randy
0 Kudos
2 Replies
Steven_L_Intel1
Employee
774 Views
See this Fortran_WinPrint example code. This works MUCH better than writing directly to LPT1. Just add the module source to your project and call Print_Unit after you've written the file to disk.

Steve
0 Kudos
sabalan
New Contributor I
774 Views
Randy, I think your problem depends on CARRIAGECONTROL='FORTRAN', which skips the first character. Take away that or replace it with CARRIAGECONTROL='LIST' (or ='NONE', depending on your file format). For more information see OPEN Statement in the on-line help.

Regards,
Sabalan.
0 Kudos
Reply