Mail Archives: djgpp/1999/09/12/17:06:35
I don't know if you have already received some replies to this question, and if
you have, they're probably more useful.
Anyway, to answer #1, the easy one, yes. It does.GCC has support for 64-bit
integers (long long. long int is the same as int(32 bit), and a a short is a
16-bit int [But you probably already knew that]) on most platforms (Linux x86 and
DOS x86 included).
For #2 I should say that I have never been very successful w/ file I/O in C (Yes,
I know that I should learn it. In the course on C++ I took, we got very behind
and never got to chapter 9 (File I/O). I haven't had much time since then to
buckle down and figure it out).
Anyway, why not try a union w/ a float and (long) int for floats, and a union w/
double and long long int for your double. That should be the simplest, and then
there are no problems w/ casting pointers, or dealing w/ pointers at all.
Hope this all helps, and hope that none of it obfuscates. Good luck and happy
coding!!!
Tom Morton wrote:
> I have 2 questions:
>
> 1. Does djgpp support 64-bit integers?
>
> 2. I need to store float and double variables in a binary savegame file.
> How is this done using getc/putc. My plan is to shove the address of
> the float into a long integer pointer and then write the float to the
> file as if it is an 32-bit integer. Saving doubles would involve saving
> the first and second 32-bits as seperate chunks. (Doubles are 64-bit, right?)
> Does that sound correct? I realise that to save long integers I will have to
> break them into bytes first.
>
> --
> Yikes Station: Frontier Elite 2 Website
> http://www.yikesstation.freeserve.co.uk/frontier/yikes.htm
>
> Tom 'Moretom' Morton
- Raw text -