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 DBPro Corner / Stored Integers in files - Binary data and Bytes.. help!!

Author
Message
RedRain
21
Years of Service
User Offline
Joined: 11th Jun 2003
Location:
Posted: 22nd Oct 2003 19:01
I basically want to read a tile map in from a seperate file source which will essentially be a sequential list of integers. I'm just trying to understand how the values are stored in the file. Take for example the number 500,000. This will be stored as 3 bytes of values 32,161, and 7.

How does this work?

All I can get back to is 496,262 from this number set. E.G:

(7*255) = 1785
1785 + 161 = 1946
(1946 * 255) = 496,230
496,230 + 32 = 496,262

I really don't understand binary and whatever that well. Any help will be much appreciated!!
cheers!
RedRain
21
Years of Service
User Offline
Joined: 11th Jun 2003
Location:
Posted: 22nd Oct 2003 19:21
Hang on I just got it... You multiply by 256 thus:

(7*256) = 1792
1792 + 161 = 1953
(1953 * 256) = 499,968
499,968 + 32 = 500,000

So can anyone tell me why you multiply by 256, when the max byte size is 255?

Never was much good at maths..

Login to post a reply

Server time is: 2024-09-21 05:33:50
Your offset time is: 2024-09-21 05:33:50