integer function record_length(bytes)
! Some compilers use record lengths in units of bytes.
! Some compilers use record lengths in units of words.
! This is an utter *pain* for reading unformatted files,
! where you must specify the record length.
!
! In:
! bytes: number of bytes in record type of interest (should
! be a multiple of 4).
!
! Returns:
! record_length: size of record in units of the compiler's
! choice.
integer, intent(in) :: bytes
integer :: record_length_loc
inquire(iolength=record_length_loc) bytes
record_length = (bytes / sizeof_int) * int(record_length_loc)
! 8 indicates 8-byte words I think
end function record_length