Can FORTRAN read bytes directly from a binary file?
===

Have a task I need to accomplish in FORTRAN.  You will tell me that FORTRAN is not the tool for this, and I agree.  But for reasons I won't waste your time with, I am stuck.

So: I have a binary file that I would like to read with FORTRAN.  Problem is, it was not written by FORTRAN, so it doesn't have the record length indicators.  So the usual unformatted FORTRAN read won't work.

I had a thought that I could be sneaky and read the file as a formatted file, byte-by-byte (or 4 bytes by 4 bytes, really) into a character array and then convert the contents of the characters into integers and floats via the transfer function or the dreaded equivalence statement.  Doesn't work.  I try to read 4 bytes at a time and, according to the POS output from the INQUIRE statement, the read skips over like 6000 bytes or so, and the character array gets loaded with junk.

So that's no go.  Is there some detail in this approach I am forgetting?  Or is there just a fundamentally different and better way to do this in FORTRAN?  (BTW, also tried reading into an integer*1 array and a byte array.  Even though these codes would compile, when it came to the read statement, the code crashed.  Couldn't figure out how to do the read.)