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

Curiosity - File Content Determination?

Intel_C_Intel
Employee
374 Views
I have some FORTRAN code that opens a file with FORM = 'FORMATTED', STATUS = 'UNKNOWN', RECL = 1024, CARRIAGECONTROL = 'LIST'. I write out some formatted records.

I can open my file in Notepad, which seems happy that the content it text (or at least, can be displayed as text).

If I use DevStudio to try to open the file, specifying the type as Text, DevStudio claims the file is binary and won't open it (it will open it as binary).

If I then open the file in Notepad, save it and close it, I can then open it in DevStudio as text.

I checked and the file does not change size in any way, even by a byte. So how does DevStudio determine the type of the contents of a file? And why does it 'get it wrong'?

Of course, Notepad is probably displaying a binary file as text (as it always tries to do), it just so happens that the binary is text...
0 Kudos
2 Replies
Steven_L_Intel1
Employee
374 Views
My recollection is that DevStudio looks to see if there non-printing characters in the file. I'd want to see the actual file (before NOTEPAD) before commenting further - can you attach a ZIP archive of an example?

Steve
0 Kudos
Intel_C_Intel
Employee
374 Views
Steve, you're right, my original file has some NULL characters in it, which are replaced with spaces when saved from notepad. Seems odd because they result from the line:

WRITE (filun, 1000) in_field

where

1000 FORMAT (6(A,','))

(in_field is a CHARACTER*16 array, width = 18)

The same formatting line is used elsewhere and does not output NULLs. E.g.:

WRITE (filun, 1000) in_unit

where in_unit is a CHARACTER*10 array).
0 Kudos
Reply