Fortran Formatted output problem in Fortran

  • Thread starter Thread starter chaimluria
  • Start date Start date
  • Tags Tags
    Fortran Output
AI Thread Summary
The discussion centers on an issue with formatted output in a programming context, specifically related to WRITE statements within a DO LOOP. The original poster, C. Luria, successfully achieved formatted output when all WRITE statements were at the end of the program but encountered a problem when moving a WRITE statement into the loop, resulting in a binary output file. A suggestion was made to include format specifiers directly in the WRITE statement. Ultimately, C. Luria reported that the problem resolved itself, likely due to a syntax error, and expressed gratitude for the assistance received.
chaimluria
Messages
2
Reaction score
0
Hello,

I have correctly defined my OPEN and CLOSE statements. When all of my WRITE statements with their associated FORMAT statements are at the end of the program I get the formatted output that I need.

If I move one of the WRITE statements to the body of the program (within a particular DO LOOP) I get a binary output file.

What am I doing wrong. How can I have a WRITE statement in the body of a program and still get formatted output.

Regards,

C. Luria
 
Technology news on Phys.org
It would help to see some code, I've never seen something like that. However, rather than having format specifiers, you could try putting the format in the write statement, e.g.
Code:
DO i=1,n
  WRITE(10,(2G15.3,A4)) data
END DO
 
The problem seems to have resolved itself. I must have made some sort of syntax error. Thank you minger for your reply and suggestion.
 
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
8
Views
1K
Replies
29
Views
5K
Replies
59
Views
11K
Replies
8
Views
4K
Replies
12
Views
1K
Replies
6
Views
3K
Replies
6
Views
3K
Replies
4
Views
2K
Back
Top