All Input subroutines use an internal buffer to read from files. The sequential subroutines (ReadNext( ) and ReadNextRecord( )) fill a buffer starting at the beginning of the next line, and expect to find the end of the line in the buffer. If they do not, they keep increasing the buffer's size until they either find the end of the line or run out of system memory. The random access subroutines (ReadLineNumber( ) and ReadRecordAtLine( )) first scan the file to find the beginning of the specified line by repeatedly filling and scanning the file's buffer until the specified line is found. A buffer size of 1K is best, and increments of 1K are recommended when increasing or decreasing the buffer's size (see Parameter Adjustment Subroutines).
The Input subroutines count lines as they scan the file, and keep track of where each scanned line is located. This information, called a file's index, is stored in a buffer in memory. With a large file, the index could grow unreasonably large. Therefore, each file has a limit on its index size. When the limit is reached, ReadLineNumber( ) and ReadRecordAtLine( ) reduce the index size by storing only half as many line locations while scanning the file. The index then stores the beginning position of every other line. This process of reducing the index size is repeated as necessary to keep each file's index under its specified limit, which starts at 1024 bytes (1K) total space, or 256 line beginning positions, since each index takes up 4 bytes. You can alter the limit by calling SetIndexSize( ) for a specified file (see Parameter Adjustment Subroutines).