I need to load a binary file directly into an I6 array.
My project is for Glulx, so I have currently conjured up an I6 function that reads 4 bytes of a file at a time (using FileIO_GetC) and using some bit shifts creates a word value to store as an array element. All working fine, but this is a slow routine for a large file, so is there a simple clean way to read a binary file directly into memory?
FileIO_GetC calls glk_get_char_stream. There’s another Glk function glk_get_buffer_stream(stream, array, bytecount) and returns the number of bytes read. You could write a new function FileIO_GetArray which invokes that, analogous to FileIO_GetC.