;The easiest for you is to use the uniform vector type. A very useful
;data type available in scm/guile. In guile there are also structs which
;allows for more complicated binary patterns.
;A very simple test program that writes and read two 32 bit numbers
;Make a uniform vector of type and size you want.
;The -1 is a prototype which means signed integer, 1 is unsigned
(define twonumber (make-uniform-vector 2 -1))
;Fill them with some numbers
(array-set! twonumber 255 0)
(array-set! twonumber 65280 1)
;Write the numbers binary to file
(define out (open-output-file "twonumber"))
(uniform-vector-write twonumber out)
(close-output-port out)
;Read them back again in another vector
(define numbers (make-uniform-vector 2 -1))
(define in (open-input-file "twonumber"))
(close-input-port out)
(uniform-vector-read! numbers in)
; Try
(apropos "uniform-vector")
; and check docs about uniform vectors. If you are communicating data
; between different endian machines the cleanest way is to use an
; intermediate file for the conversion.
Best reagards
Roland
------------------------------+---------------------+-----------------
Roland Orre | O---O---O Studies of| orre@nada.kth.se
SANS, NADA, KTH | |\ /|\ / Artificial|
S-100 44 Stockholm, Sweden | O-O-O-O Neural |Wph:+46 8 7906984
------------------------------+ |/ \ /| Systems |Fax:+46 8 7900930
Dept. of Computing Science | O---O-O +---------|Mob:+46 70 8269748
Royal Institute of Technology | |http://www.nada.kth.se/~orre
------------------------------+----------+----------------------------