[r6rs-discuss] Mixed binary and ascii data in a single file

Bradley Lucier lucier at math.purdue.edu
Wed Aug 8 16:20:24 EDT 2007


On Aug 8, 2007, at 4:03 PM, Alan Watson wrote:

> Astronomical FITS files also have an ASCII header followed by  
> binary data. One option is to treat the file as binary and grab the  
> header character by character. Another is to open the file twice,  
> once as an ASCII text stream and once as a binary stream, read the  
> header from the text stream, calculate the length of the header in  
> bytes, offset the binary stream to the start of the binary data,  
> and finally read the data from the binary stream.

Thanks for your reply.  Now that you remind me, I remember that I've  
worked with FITS files, too, in the now-distant past.

The r6rs solutions seem fairly clumsy compared to what is available  
in Gambit (and perhaps in other implementations), where you can  
change the buffering of a port after it has been opened.  (Or at  
least, you can safely change it from unbuffered to buffered after it  
has been opened.)

Brad



More information about the r6rs-discuss mailing list