Binary files on 4D machines

Calvin H. Vu calvin at dinkum.wpd.sgi.com
Fri Aug 17 04:11:47 AEST 1990


In <9008151931.AA04768 at aero4.larc.nasa.gov> blbates at AERO4.LARC.NASA.GOV ("Brent L. Bates AAD/TAB MS361 x42854") writes:


|    Does anyone know if SGI plans on FIXING their FORTRAN, so that
| we can write true binary files, the way we can on the 3000's.
| This capability is SUPPOSE to be in release 3.3, however, it doesn't
| work.  I want to open a file with a command like:
| 
|     open(unit,file='filename',form='binary')
| 
|    Then write to the file:
| 
|     write(unit) data
| 
|    Writting to a binary file should be as easy as writing to a
| sequential unformatted file, the ONLY thing I should have to
| change is the 'form' parameter in the open statement.
| --

In 3.3, there are two new ways to open a file:

1) open(unit,file='filename',form='binary')
	allows you you to read/write binary data using formatted I/O.  E.g:

	I = 10
	write (1, 10) i
10	format(a4)
	rewind(1)
	read(1, 10) j
	print *, i, j
	end
	It is not the same as FORM='BINARY' on the 3000 series, however.

2) open(unit, file='filename', access='direct', recl=1, form='unformatted')
	provides the same capability as opening file with FORM='BINARY'
	on the 3000 series.  There will be no record marks and the file
	is treated as sequence of bytes to be consumed/written.  To make
	this work the program has to be compiled with -old_rl option so
	that the record length is interpreted as the number of bytes (the 
	default is number of words).
	You only need to change the OPEN statement of the 3000 series' Fortran
	to make it work in the same way on the 4D i.e. you only need to 
	modify one line for each opened binary data file.   READ/WRITE 
	statements won't need to be changed. 
	

| 
| 					Brent

There's also a write-up in the release notes for this.   If you experience
any incompatibility besides the cosmetic change in the way the file is opened
please let us know.

- calvin
--
-----------------------------------------------------------------------------
Calvin H. Vu			   | "We are each of us angels with only one
Silicon Graphics Computer Systems  | wing.  And we can only fly embracing
calvin at sgi.com   (415) 962-3679	   | each other."



More information about the Comp.sys.sgi mailing list