View Single Post
Re: Bitz and Bytes , saving with fWRITE
Old
  (#10)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: Bitz and Bytes , saving with fWRITE - 22-01-2004

Hey stefan.

I have successfully got my waypoint visibility files to read and write at different sizes.

For starters, when you save the cVisTable, you may need to add an extra byte because when you divide and cast to an int you may lose some floating point info, so you need to Ceiling (round to above integer, but if x.0 then its just x) that value to get the proper size.

When you load you need to estimate the size of the file and get the filesize, if they don't match then you have to re-build the vistable etc. :/ You can get the filesize by using fseek to end of file (SEEK_END ?) and use ftell to get the filesize (in bytes) also fseek back to SEEK_CUR i think.
  
Reply With Quote