Curiosity - File Content Determination?

Curiosity - File Content Determination?

Community Admin's picture

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...

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Steve Lionel (Intel)'s picture

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

Steve
Community Admin's picture

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).

Login to leave a comment.