DJGPP / 32bit <-> 16bit files r/w !?

DJGPP / 32bit <-> 16bit files r/w !?

Post by ^Hawk^ (Thorsten Kab » Sat, 28 Mar 1998 04:00:00



Hello !

I've a problem ... I've a given struct of a 16bit file where an int
16bit is and a lon 32bit (only a 16bit file struct :) ... so far so
good ... but how can I read / write 16bit files with DJGPP !?

If I try to translate the structs and read / write the 16bit files
then I've never the stored datas and at the writing are my created
files always to long ... if I've a file that's 338 bytes long and I
try to write the same file then it's 588 bytes long ... :((= ...

Any hints !? What must / can I do !?

Bye, ^Hawk^. http://www.bubis.com/DarkSoft/

 
 
 

DJGPP / 32bit <-> 16bit files r/w !?

Post by Andrew Cottre » Sat, 28 Mar 1998 04:00:00




>Hello !

>I've a problem ... I've a given struct of a 16bit file where an int
>16bit is and a lon 32bit (only a 16bit file struct :) ... so far so
>good ... but how can I read / write 16bit files with DJGPP !?

>If I try to translate the structs and read / write the 16bit files
>then I've never the stored datas and at the writing are my created
>files always to long ... if I've a file that's 338 bytes long and I
>try to write the same file then it's 588 bytes long ... :((= ...

>Any hints !? What must / can I do !?

>Bye, ^Hawk^. http://www.bubis.com/DarkSoft/

If you want to make the source code portable between all compilers the
only safe way to write the code is to use byte read/writes and then
convert to/from ints. It is time consuming to write, but once done it
can work with big endian or little endian systems and all standard
compilers for major OS's (Unix, Win, DOS, VMS, Solaris........etc).

Andrew

 
 
 

1. DJGPP / 32bit <-> 16bit files r/w !?

I had this problem when I was working on my .pcx file loading routines.
Namely, the height and width as encoded in the file is a 16-bit integer
type, but DJGPP is 32-bits.  So, what I did was I changed all the ints
to shorts in DJGPP, which are 16-bit, and so worked perfectly.

--

http://www.geocities.com/SiliconValley/Lakes/3574/index.html

2. stl multimap

3. <><><> DELETING VARIABLES <><><>

4. Unable to delete interrupted messages

5. <<<*<< HOW TO DISKCOPY Without Swapping diskettes >>*>>>

6. Home Phoneline Network and Cable modem

7. >>>>WIZARD>>> How do read VAX/VMS files on a PC <<<WIZARD<<<<

8. Anyone have extra 256K SIMMs?

9. ><><><>< 4DOS.COM - SIZE ><><><><

10. <<>> COMPUTER SOFTWARE / HARDWARE <<>>

11. How to "Echo >>>><<<<" ???

12. <<>> COMPUTER SOFTWARE / HARDWARE <<>>

13. ><><><>< 4DOS.COM - S