Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29281 Discussions

File I/O Unformatted Stream Vs Binary

ScottBoyce
Novice
937 Views

I am not familiar with opening a file with form set to Unformated with Acess set to Stream. Is this identical to opening a file with form set to Binary. If not, since they are record free files would something written with both forms produce the same binary? What would be the pros/cons between them if there is a difference. Right now I am able to postprocess form set to binary with python, but I assume it should work with stream because its equivalent to a C-binary?

 

Thanks as always.

0 Kudos
4 Replies
Steven_L_Intel1
Employee
937 Views

Yes, it's the same (for unformatted). 'BINARY' is an extension, ACCESS='STREAM' is standard.

0 Kudos
ScottBoyce
Novice
937 Views

So

[fortran]

Open(UNIT=55,FORM='unformatted',ACCESS='STREAM')

[/fortran]

would produce the same file as:

[fortran]

Open(UNIT=55,FORM='BINARY')

[/fortran]

0 Kudos
Steven_L_Intel1
Employee
937 Views

Assuming all the WRITEs are the same, yes.

0 Kudos
nvaneck
New Contributor I
937 Views
I've been using FORM='BINARY' for years now with scratch files and a few others. I understand that the introduction of STREAM was at least partly to standardize the way different compilers implemented BINARY, for compatibility reasons. There was one little twist I found; I was using ACCESS="APPEND' in one case,, which is another extension and incompatible with STREAM. Fortunately, the POSITION keyword in OPEN came to the rescue....
0 Kudos
Reply