Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

File output from Compaq Visual Fortran

Brebrick__Robert
Beginner
664 Views
Recently with a new Fortran program my output file contains what appears to be hexadecimal characters in addition to the formated text and numbers scattered in the last columns... when the output file is viewed while still in the Fortran environment. ( I'm a complete novice and probably don't describe things correctly). On the screen the ouput is OK, no hexaadecimal characters only formated output. When I leave the Fortran environment and look at the output file from Windows explorer, using Notepad, everything is OK, no hexadecimal.Have I inadvertently picked some setting responsible for this?
..... I set the input and output file names from the command line. I give the output file name the extension .out. This has worked before with other programs. I wonder if I inadvertently set something while in debug in the early editions of the program.

Message Edited by rbrebrick@milwpc.com on 04-13-200610:54 AM

0 Kudos
5 Replies
greldak
Beginner
664 Views
It sounds as if you have given your output file a non standard extension. The IDE will open files it believes are text files e.g. those with extensions .f, .f90, .for, .c, .txt (there are others also) in a text based editor but many other extensions will be assumed to be binary files and will open in a binary editor where you have the hex representation and the ascii to the right.
0 Kudos
Brebrick__Robert
Beginner
664 Views
I don't think the file ectension is the problem. See edited message
0 Kudos
Jugoslav_Dujic
Valued Contributor II
664 Views
You activated "binary" viewer somehow. When you do a file/open, the default mode is "auto" (combo on the bottom of the open dialog). I'm not sure how it works, but it may be that VS analyses the file, and if it encounters any non-ascii character, it opens it in "binary" mode; if you don't see it, it doesn't mean it isn't there. For example, you won't see char(0), char(1) and quite a few others.

You can force normal "text" viewer by selecting "Text" in the "Open as" combo. You may want to investigate, though, whether there are non-ascii characters in the file (I'm not sure what the criterion is, possibly 32 (20 hex) is treated as non-ascii).
0 Kudos
Brebrick__Robert
Beginner
664 Views
The problem was encountered using Compaq Visual Fortran version 6.5. I accidentally discovered the reason. I was using Call Fdate(Today) and had given the Character staement for Today as A32. Using A24 the problem disappears.
CHARACTER *24 TODAY
CALL FDATE(TODAY)
WRITE(7,2) TODAY
2 FORMAT(A24)
Evidently, on using A32the program fills the the unused spaces with binary characters. Then on opening the output file and even stipulatingit to be a text file in the open menu doesn't work. The program answers the file is a binary file. I discovered this when one time I tried to open an output filewithin the Visual fortran environment and got a warning that the file noncontained non text characters or something and these were going to be converted to periods. Why this warning finally came up is unknown to me.
0 Kudos
Steven_L_Intel1
Employee
664 Views
That's a bug, and I can reproduce it in IVF too. I'll report it.
0 Kudos
Reply