[gambit-list] Reading binary files
Bradley Lucier
lucier at math.purdue.edu
Tue Dec 18 23:32:13 EST 2007
On Dec 18, 2007, at 10:31 PM, Bob McIsaac wrote:
> (define (integer-in )
> (set! *filesize* (- *filesize* 4))
> (bitwise-ior
> (bitwise-and (arithmetic-shift (read-u8 INP) 24) #xff000000)
> (bitwise-and (arithmetic-shift (read-u8 INP) 16) #xff0000)
> (bitwise-and (arithmetic-shift (read-u8 INP) 8) #xff00)
> (bitwise-and (read-u8 INP) #xff)))
This code assumes that arguments to functions are evaluated left-to-
right.
Do
(let* ((byte-1 (read-u8 INP))
(byte-2 (read-u8 INP))
etc.
More information about the Gambit-list
mailing list