This looks like the good old BlockRead from Turbo Pascal

To Read the entire file you could have a buildin function like:

BlockRead(Handle, Numbytes)

Just a suggestion of how to implement this witout using pointers [Wink]

The function should return the bytes read from the file, @Error should return the actual number of bytes read (file could be less than NumBytes)
I know this is reversing the meaning of @Error, in this situation: 0 would be an Error or nothing read!

Pseudocode example:
code:
$Handle = 1
$NumBytes = 100
$RC = Open($Handle,'BinFile')
If $RC = 0
$Read = BlockRead($Handle,$NumBytes)
$NumRead = @Error
While $NumRead > 0
For $i = 1 To $NumRead
$Char = SubStr($Read,$i,1)
; Do something with the char !!
Next
$Read = BlockRead($Handle,$NumBytes) ; NumBytes could be optional, only needed for first BlockRead
$NumRead = @Error
Loop
EndIf
$RC = Close($Handle)

Ofcourse this could have a BlockWrite() compagnion. We would then be able to manipulate small binary files.

-Erik

[ 13. January 2003, 22:43: Message edited by: kholm ]