473,503 Members | 1,685 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to pack integer into 24bits (3 bytes)?

Hi,

I am trying to pack an integer into 24bit value - 3 bytes, and write it to a
file. I would like to know, if anyone knows if this is possible and how?
Also, how to unpack that value back
Mar 19 '07 #1
1 2565
nm, I've figured it out with shifting
Mar 19 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
15584
by: Stacy Mader | last post by:
Greetings all, I have a VMS binary file with weather data. The record on each line is 1xint(8) 12xint(2) Using the perl unpack function, I can decode the binary file like this: <snip>
4
13446
by: gimme_this_gimme_that | last post by:
It's larger than 9999. What does the 4 refer to? Thanks.
18
7535
by: p.lavarre | last post by:
Can Python not express the idea of a three-byte int? For instance, in the working example below, can we somehow collapse the three calls of struct.pack into one? 08 12 34 56 80 00 I ask...
8
5624
by: active | last post by:
I have this and it seems to be working OK but now I wonder if the Pack value shouldn't be 1. What do you think? <StructLayout(LayoutKind.Sequential, Pack:=4, CharSet:=CharSet.Auto)_ Public...
11
2208
by: cmdolcet69 | last post by:
Public Shared adc_value As word_byte Public Class byte_low_hi Public low_byte As Byte Public high_byte As Byte End Class pmsg(2) = CChar(adc_value.word16.high_byte)
0
927
by: murayama | last post by:
Hello! Maybe this question has already popped up somewhere, but I'm new to this forum and there is apparently no way to search the past questions and answers... I have written a script that...
8
2033
by: sexauthor | last post by:
I'm converting a VB6 application over that called a 3rd party DLL with specific data structures. The VB6 code defined custom types for those data structures (ie: one with the specific data types,...
4
4553
by: rkmr.em | last post by:
hi i want to send unsigned 32 bit integer to socket, and looking for something equivalent to this method... http://livedocs.adobe.com/flex/2/langref/flash/net/Socket.html#writeUnsignedInt() ...
1
4694
by: Chintan Shah | last post by:
I have a byte array which looks something like 01 00 02 00 73 45 69 A5 So i have to read first 2 bytes and convert it into integer to get its value. Same for next 2 bytes and then next 4...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.