Sending output to printer

Sending output to printer

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

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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

Steve - Intel Developer Support

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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today