- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The code I'm working on reads in large, variable-length sequential-access binary files. The files are read gradually throughout the execution of the code. Based on the user's input, the length of each record could be determined a priori.
I'd like to add a check to make sure the length of the file that the user has supplied is appropriate before the calculation starts. The idea is to prevent the user from burning hours of compute time only to discover that they supplied a bogus data file. Is there any way to quickly read each leading length field in the file?
I'd like to add a check to make sure the length of the file that the user has supplied is appropriate before the calculation starts. The idea is to prevent the user from burning hours of compute time only to discover that they supplied a bogus data file. Is there any way to quickly read each leading length field in the file?
Thanks,
Greg
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IFort provides the routine GETFILEINFOQQ in module IFPORT, by calling which you can obtain the length of the file.
If, as you stated, you can find the length of each record based on user input, and if you can determine the numbers of records of each known length in the file, you can compute the expected file length from the user input and compare that to the file length returned by GETFILEINFOQQ.
If, as you stated, you can find the length of each record based on user input, and if you can determine the numbers of records of each known length in the file, you can compute the expected file length from the user input and compare that to the file length returned by GETFILEINFOQQ.

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