Skip to content

Using readBin to read binary "unformatted" output files from Fortran?

4 messages · Duncan Murdoch, David Winsemius, Jooil Kim

#
On 12-02-14 10:58 PM, Jooil Kim wrote:
Yes, that should have worked.  To debug, I'd replace your second line with

readBin(to.read, "raw", n=100)

For example, when I create a file by writing out 1:10 using writeBin, 
that gives

 > readBin(to.read, "raw", n=100)
  [1] 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00
[20] 00 06 00 00 00 07 00 00 00 08 00 00 00 09 00 00 00 0a 00
[39] 00 00

from which it is pretty obvious the file contains small integers in 
little endian form.  Paul Murrell's hexView package gives more elaborate 
possibilities.

Duncan Murdoch
#
On Feb 15, 2012, at 5:41 AM, Duncan Murdoch wrote:

            
Jooil Kim;

Are you sure that is the complete file name? The MacOS (like Windows)  
will hide the extensions of some files when using Finder.app unless  
you change the defaults.