Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29249 토론

How to read the record length of unformatted sequential file

tlillys
초급자
485 조회수
Hello all,
A post-processing code I am updating was written for Open Watcom 1.1 and makes use of the fnextrecl function to process an unformatted, sequential file. The function (I'm guessing) reads the first 4 bytes of the file to determine the record length and then some decision work is performed based on that length.
I am looking for a way to do the same thing in CVF 6.6c: determine the length of the next record and read the record based upon the returned length. A two step work around is fine, too (e.g., read and store the length of each record, rewind, and process).
thanks in advance
tlillys
0 포인트
1 응답
Steven_L_Intel1
485 조회수
The way I would handle this is to open the file FORM="BINARY" and read the length words directly as an integer. There is a 32-bit integer length preceding and following the data. See the Programmer's Guide for details on the layout.
0 포인트
응답