- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a way how to find out if a binary file was written using direct or sequential access without opening it and reading values from it?
If I have to open the file and start reading values, how would I know that opened the file using an access that is different from the one used to write the file?
Thank you in advance for any suggestions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the old days (let's say around 1980 thereabout) (some?) computer systems used to distinguish between direct-access and sequential-access, but nowadays there is no such difference anymore, at least not with current-day compilers and run-time systems that I am aware of.
There is a difference between binary and unformatted sequential files, but if your file is indeed binary (so no inherent record structure, as opposed to unformatted sequential files), then direct-access simply means a different way of positioning the read/write action within a file for all intents and purposes.
In fact, stream access should work fine even if the file was written as direct-access. (I know in the past some compilers might add some marker in the file to make sure the record length was correct, but that was years ago).
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the old days (let's say around 1980 thereabout) (some?) computer systems used to distinguish between direct-access and sequential-access, but nowadays there is no such difference anymore, at least not with current-day compilers and run-time systems that I am aware of.
There is a difference between binary and unformatted sequential files, but if your file is indeed binary (so no inherent record structure, as opposed to unformatted sequential files), then direct-access simply means a different way of positioning the read/write action within a file for all intents and purposes.
In fact, stream access should work fine even if the file was written as direct-access. (I know in the past some compilers might add some marker in the file to make sure the record length was correct, but that was years ago).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for pointing me in the right direction - the stream access works well for what I need to do, even for direct access written files.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page