473,508 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Low Byte into High Byte. Bits conversion.

2 New Member
Please,i need help.

My problem is to change low Byte and High Byte with the help of serialization and deserialization. Frankly speaking i dont have any idea how to do it. I am sitting 3 hours already, maybe my brain was not ready for C yet :)))
Apr 1 '15 #1
4 2157
weaknessforcats
9,208 Recognized Expert Moderator Expert
Exactly what do you need to do?

When you say low byte swap with high byte do you mean an array of 4 bytes like 1234 gets changed to 4321?
Apr 1 '15 #2
Civetta
2 New Member
I have to write a funktion which changes the places of Low Byte (Bits 0-7)and High Byte
(Bits 8-15) e.g. 0x4020 gets changed to 0x2040.
Apr 1 '15 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
Have you considered casting your number as an array of 2 unsigned char and then swapping array[0] with array[1]?
Apr 2 '15 #4
donbock
2,426 Recognized Expert Top Contributor
What is the prototype for this function that you're writing? Defining the prototype will specify the inputs and outputs of the function; and this should help to clarify your thinking.
Apr 2 '15 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

15
3561
by: jeko | last post by:
Hi, is it possible to read a double variable one byte at a time. I would want store each byte into unsigned char and then assemble again the double variable again. thanx Andrea
1
32775
by: Wasim Akram | last post by:
Hi, I have a field "Month" in my SQL server table. The type of this field is "tinyint". Now what I am doing in the code is using DataRow to read this field in a 'int' variable. int month...
32
6308
by: Guoqi Zheng | last post by:
I am really do not know so much about byte/bit, etc. Question, if I defined a byte(), how can I add a single byte to it? what I want is that I have an array of bytes, I loop that array, look at...
6
4523
by: Narshe | last post by:
How can I convert a byte into a byte?? You can assign a byte to a byte?, but you obviously can't do that with an array. The way I'm currently doing it is a for loop that just copies the data...
6
14659
by: Seabass | last post by:
Hello everyone, I'm trying to do a Hex Viewer in C#. I'm reading the user selected file byte by byte but it seems to take forever ( one minute to read a larger file ). Is there any way to make...
3
5018
blazedaces
by: blazedaces | last post by:
I was working all day yesterday (and will probably be for most of today) with bytecode where java wrote the bytecode and matlab read it... I had never worked with bytecode in great detail before so...
3
3818
by: efdeugenio | last post by:
Hi, I will really appreciate if someone cans help me with this: I have a managed c++ class that I am calling from C#. The declaration of a function in this class is: bool CanAddTemplate(unsigned...
6
3317
by: Ashit Vora | last post by:
Hi, I had one small query. I 'm coping data from an unsigned short to a char*. code is #include<stdio.h> int main(void){ unsigned short type=0xFE10;
18
23435
by: wquatan | last post by:
Does someone know an (fast) example of reading files in VBA, Byte per Byte ? I need to be able to take action on every single byte Thx
1
2234
by: cjlee | last post by:
- API Function TestSend(ref char data, ref int len, char slot); --------------------------------------------------- Byte IccSelect = new Byte{ 0x00, ...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7405
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...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5059
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
4724
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
3214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
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 ...
0
435
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.