Simple File I/O [message #58351] |
Fri, 25 January 2008 16:50 |
Gary
Messages: 4 Registered: January 2008
|
Junior Member |
|
|
This questions stems, as much as anything, from my newness to
programming in general. I would like to take a pixmap my code
generates, save it as a file for later use, and then read it in later
after having restarted the code. Thus far, I've tried simply using
writeu and readu. The error comes when readu is reached producing the
error, readu: end of file encountered. I use TVRD() to generate a
float array from the pixmap then writeu this to a file. This produces
a file of byte format? On the other end, I generate a float array hard
coded to the same size as the original pixmap, and simply use readu
into the float array, whereupon I get the end of file encountered
error. I think I'm missing something between the conversion between
the original float array to bytes and then back again. Also, fstat
tells me that there are four extra bytes to the number of cells in the
original array. 460x920 = 423200 cells, but fstat gives a file size of
423204 bytes. I'm guessing its really simple and I'm just missing it.
Any and all help much appreciated.
-g
|
|
|