- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem you have is that unformatted sequential read is not just a stream of bytes. There is a record structure imposed consisting of a four-byte record length, the data, then the four-byte record length again.
You are using the unsupported Intel Fortran 7.1 compiler. I know that version 8 and later has FORM='BINARY' which can be specified in the OPEN to remove the record structure and allow reading of arbitrary byte streams. I would recommend moving to the current version 9.0 compiler - it has a lot of improvements.
You are using the unsupported Intel Fortran 7.1 compiler. I know that version 8 and later has FORM='BINARY' which can be specified in the OPEN to remove the record structure and allow reading of arbitrary byte streams. I would recommend moving to the current version 9.0 compiler - it has a lot of improvements.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Another important consideration for binary strucuture I/O is that you should use the SEQUENCE attribute in types, and you should be sure that the data structure can be aligned without any padding. In your example, you have an odd number of integers followed by reals. If the integers are smaller than the reals it can be a problem.
Generally, if you lay out data so that it is aligned with no holes, SEQUENCE will have no effect. But, the compiler is allowed to reorder members if you do not have the SEQUENCE attribute.
Generally, if you lay out data so that it is aligned with no holes, SEQUENCE will have no effect. But, the compiler is allowed to reorder members if you do not have the SEQUENCE attribute.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page