Question about printing with FORTRAN

In summary, the conversation is about the possibility of printing FORTRAN output using FORTRAN code, specifically to a local printer. The person asking the question has searched online but has not found much information. Another person suggests checking the compiler's manual for an option to associate a unit number with a locally-connected printer.
  • #1
DoktorD
6
0
Hey guys,

I tried looking around on the web and came back without much luck..

Is it possible to print FORTRAN output using FORTRAN code? When I say "print," I mean to a local printer such as a laserjet.. not just printing to the terminal screen..

I've searched pretty intensely on the internet, but haven't found much at all.. I was hoping you guys could at least point me in the right direction.

Thanks!
 
Technology news on Phys.org
  • #2
Once upon a time, when I learned Fortran more than 35 years ago, a certain I/O unit number was always associated with the "line printer," I think it was 3, so you could write something like WRITE (3, 20) FOO, BAR to write to the printer. But that was in the days of hard-wired printers and before software-based printer interfaces (drivers).

Your compiler might have an option available in the OPEN statement that allows you to associate a unit number with a locally-connected printer, or more properly, with its printer driver. You'll have to look in your compiler's manual. It's probably compiler- and OS- specific.
 

1. What is FORTRAN and how is it used for printing?

FORTRAN is a programming language used for scientific and engineering applications. It stands for Formula Translation and was designed to solve mathematical and scientific problems. FORTRAN can be used for printing by using the WRITE statement, which allows for printing of variables and strings to the screen or a file.

2. How do I format my printed output in FORTRAN?

Formatting in FORTRAN is done using the FORMAT statement, which allows for control over the appearance of the printed output. This includes options such as specifying the number of decimal places, using scientific notation, and adding text or symbols.

3. Can I print arrays or matrices in FORTRAN?

Yes, FORTRAN allows for the printing of arrays and matrices using the DO loop and the WRITE statement. This allows for easier visualization and analysis of data in a tabular format.

4. How do I print to a specific location on the screen or page in FORTRAN?

In FORTRAN, the PRINT and WRITE statements have the option to specify the position on the screen or page where the output will be printed. This can be done using the ADVANCE keyword, which allows for control over the number of spaces or lines to skip before printing.

5. Is it possible to print graphics or images using FORTRAN?

While FORTRAN is primarily used for numerical computations, some versions of the language do have graphics capabilities. This includes the ability to print simple graphics or images using the PLOT statement or external libraries. However, it is not commonly used for this purpose and other programming languages may be better suited for graphics and image printing.

Similar threads

  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
12
Views
7K
  • Programming and Computer Science
Replies
11
Views
9K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
2K
  • Programming and Computer Science
Replies
7
Views
134K
  • Programming and Computer Science
Replies
7
Views
973
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • Programming and Computer Science
Replies
4
Views
3K
Back
Top