* Added: fortran_bin_file.peek_next_rec_len() to fetch the next record length

while not advancing the read pointer to that record yet.
master
Wirawan Purwanto 13 years ago
parent 050e2414ef
commit 3698671bed
  1. 9
      iofmt/fortbin.py

@ -220,6 +220,15 @@ class fortran_bin_file(object):
self.write_vals(*vals, **opts)
def peek_next_rec_len(self):
"""Fetches the length of the next record, while preserving
the position of the file read pointer.
"""
filepos = self.F.tell()
reclen = numpy.fromfile(self.F, self.record_marker_type, 1)
self.F.seek(filepos)
return reclen[0]
def array_major_dim(arr):
"""Tests whether a numpy array is column or row major.

Loading…
Cancel
Save