Refer to NG for Clipper, or the Clipper manuals. Normally, freadstr() returns NULL when the size of the buffer you send "by reference (@)" to this function, exceeds the remaning bytes of the file. Usuallly the EOF() of a file is CHR(26), but not expect this always will work.
I use to manage this situation with fread() (nearly identical with freadstr() ), and check if in the buffer I read there is a chr(26), or null response, or the size of the response isn't identical that the buffer I've sent to read.
In this case, simply check for the len() of the buffer: if is different against the size of the buffer you sent, you reached the eof().
To expand on what JMike posted, do the following -
nHandle := fopen( <file> )
nSize := fseek( nHandle, 0, 2 ) // gets the size of the file
fseek( nHandle, 0, 0 ) // reposition to the begining
do while ( fseek( nHandle, 0, 1 ) <= nSize )
<Your Loop>
enddo
The 64K limit is for the number of characters that can be read at one time. It does not refer to the file size. I have openned files that are over 1Meg is size and move around in them without any trouble. Just make sure you move around in the large files in blocks less than 64K.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.