Fortran Why is Gfortran not printing on Cygwin?

AI Thread Summary
Using gfortran on Cygwin, the issue of not seeing printed output in the command window arises from how the program is executed. The WRITE and PRINT statements are correctly used, but the output may not appear if the command window closes immediately after execution. This typically happens when using the "run a.exe" command, which likely opens a new shell, causing the output to be displayed in a separate process. In contrast, executing "./a.exe" runs the program in the same command window, allowing the output to be visible. To prevent the command window from closing too quickly, adding a command that requires user input, such as prompting for a key press, can help retain the output for viewing.
kth
Messages
3
Reaction score
0
I use gfortran on cygwin and i want to print in the command window (like it prints in windows)
i use the usual stuff:

WRITE(6,*) 'Give a number:'

or

PRINT(6,*) 'Give a number:'

but the execution completes without any printing..

What is wrong?
 
Technology news on Phys.org
Does the 'black window' stays on the screen without printing anything, or does it disappears without giving you time to read what's on it?

In the former case, we will need more information.

In the latter case, it is probably because the window shuts down at the end of the execution unless you put a command to halt the closing, such as requesting user to enter a key to continue.
 
When i use the command

./ a.exe it prints int the command window

but when i use

run a.exe it does not print

I wonder what's the difference between those commands?
 
I do not have a Linux system to verify the explanation, but I believe the run command opens a new shell so printing is displayed in a different process distinct from where you entered your command "run...". On the other hand, a.exe is executed in the command screen, so you get to see the output.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
5
Views
2K
Replies
13
Views
2K
Replies
4
Views
2K
Replies
2
Views
956
Replies
19
Views
6K
Replies
3
Views
5K
Back
Top