- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi,
I have a formatted file containing 1000-2000 records. I would like to ALLOCATE an array for these numbers, but I don't know how many are in the file. The standard techniques I'm familiar with are either to write the number of records in the title line of the file (it gets read by Excel also) or to read records from the file with no input list and count the number that have been read when EOF is reached. These date from the '70's. Are there more intelligent/sophisticated/elegant solutions to the problem now?
Regards,
Keith
I have a formatted file containing 1000-2000 records. I would like to ALLOCATE an array for these numbers, but I don't know how many are in the file. The standard techniques I'm familiar with are either to write the number of records in the title line of the file (it gets read by Excel also) or to read records from the file with no input list and count the number that have been read when EOF is reached. These date from the '70's. Are there more intelligent/sophisticated/elegant solutions to the problem now?
Regards,
Keith
コピーされたリンク
1 返信
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
I suspect that counting lines is the only way to go. After all, the file systems used by Windows (and Linux and U*x) don't really have the concept of a 'record', so the only way to find out how many records there are in a file is to count end-of-line markers.
On other o/s, such as VMS or MVS, some files have fixed length records, so the number of records is just file size divided by record length.
On other o/s, such as VMS or MVS, some files have fixed length records, so the number of records is just file size divided by record length.
