Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Read files written with 16 bit ints in DBPro gives me troubles

Author
Message
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 17th Aug 2015 11:38 Edited at: 17th Aug 2015 17:36
Hello If I write a file in DBPro with WORD's (16 bit int) and read them as Short in AppGameKit, every second spot is empty.

This is how I store the file in DBPro


And this is how I read it in AGK


I have come as far as finding that if I read them as bytes instead of shorts, then everything is fine. But I will need values bigger than a 256 byte at some point. I also found that I store them 32 bit ints, read them as ints and inc N by 4, only every fourth spot is read right.

EDIT: At first I thought it could have something to do with little/big endian, but as far I understand both AppGameKit and DBPro uses little endian.

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
Eqqman
9
Years of Service
User Offline
Joined: 15th Jul 2015
Location:
Posted: 18th Aug 2015 08:36
If you are forced to use bytes, remember that you can always combine them into larger word sizes:


Goo Goo G'Joob!
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 18th Aug 2015 16:30
Thank you But why is every second spot empty?? I store it as a two byte word in DBPro and read the same value as a 2 byte short in AppGameKit, which gives me a value of 0 at every other read. As far as I understand they both use little endian. Now I have read a little about endianess and understand a bit more of how that works.

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...

Login to post a reply

Server time is: 2024-11-21 20:45:12
Your offset time is: 2024-11-21 20:45:12