473,772 Members | 2,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please help with Hex Length and Binary Word

Hi,

(First apologies if this is not the most relevant place to post this
but I wasn't sure of where was and I am writing my app in VB.)

I'm attempting to parse a binary file for which I have the format. The
format states that the general packet format is as follows

Message header
Hex Length of whole binary packet
Binary Word of above Hex Length
etc.

I just wanted to make sure of a couple of terms before I start - most
notably 'Hex Length' and 'Binary Word'.
I guess binary word is just a binary representation of the hex length
e.g. if the hex length was 8 then the binary word of hex length would
be '1000'. However, what is meant by hex length and how is it
determined? If you could provide an example I'd be grateful.

Thanks

Paul
Jul 17 '05 #1
4 6002

"Paul" <pa********@hot mail.com> wrote in message
news:ca******** *************** **@posting.goog le.com...
I guess binary word is just a binary representation of the hex length
e.g. if the hex length was 8 then the binary word of hex length would
be '1000'. However, what is meant by hex length and how is it
determined? If you could provide an example I'd be grateful.

Hi Paul.. sounds like you have to ask whoever gave you that homework as to
what he/she meant. We at the board have no idea on how to guess that
meaning. It didn't make sense to me.

The term "word" can be of different length depending on the language. In VB
you have integer, single, double, long, variant, etc. for variable types.

For obvious reason, you have to know exactly how many bytes this info is
encoded in order to "read" the header properly.
Jul 17 '05 #2

On 2 Apr 2004 01:11:08 -0800, Paul <pa********@hot mail.com> wrote:
I'm attempting to parse a binary file for which I have the format. The
format states that the general packet format is as follows

Message header
Hex Length of whole binary packet
Binary Word of above Hex Length
etc.


None of these terms have standard definitions. Look elsewhere in the
document to see how these terms are interpreted for this particular file
format. Post the document if you still can't figure it out.
Jul 17 '05 #3
I have to agree with previous contributors, but....

There are always ways of applying guesses by using common definitions. I
will analyse like this:

1. Hex means data is presented in hexadecimal format
2. Binary os obvious
3. Word is usually a 16 bit value. (compare: bit, byte, word, longword etc)
4. ength, since this is a header of course the length of the coming data
block
5. I assume the binary data length, i.e. number of binary words correspond
to the length value

No good answers but some guesses, but still one important problem: What is
the length of the hex value? If not specified this can be one byte, two
bytes, four bytes (these are the most common) or any length. I would guess
for the moment that it is one byte, i.e. two characters.

So an examle of how my interpretation would look like with some data:

0A
100110101001011 010110101111001 110110101110001 101110100110101 100010111100011 1
011001110011111 001111101001100 110101100110101 101011010101101 011010011100101 1
01101010
Ok, so what does this the tell me? Well, with these conclusions it seems
that your "binary" file is stored as a textfile, which is very uncommon and
stupid since it only adds quite a lot of length to the file. So in the end
here I am probably wrong anyway.

Final answer will then be that your description is not only very sloppy but
extremely bad. A lot of information is missing and leasve open areas for
guessing.

E.T. - wants a homing phone
"Paul" <pa********@hot mail.com> wrote in message
news:ca******** *************** **@posting.goog le.com...
Hi,

(First apologies if this is not the most relevant place to post this
but I wasn't sure of where was and I am writing my app in VB.)

I'm attempting to parse a binary file for which I have the format. The
format states that the general packet format is as follows

Message header
Hex Length of whole binary packet
Binary Word of above Hex Length
etc.

I just wanted to make sure of a couple of terms before I start - most
notably 'Hex Length' and 'Binary Word'.
I guess binary word is just a binary representation of the hex length
e.g. if the hex length was 8 then the binary word of hex length would
be '1000'. However, what is meant by hex length and how is it
determined? If you could provide an example I'd be grateful.

Thanks

Paul
Jul 17 '05 #4
Hi,

Thanks to all that responded. Apologies if there was not a lot to go
on. I figured it out after analyzing the binary file in a hex viewer.
Take for example the following extract from the binary file

40 30 30 38 31 81 00

The first byte (40 or '@') is the packet header
Hex length = 30 + 30 + 38 + 31 = 129
Binary word of hex length is as somebody suggested the next two bytes,
i.e. 81 00, or 129 in decimal.

Thanks again,

Paul
Jul 17 '05 #5

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

Similar topics

5
3360
by: john | last post by:
Here is the short story of what i'm trying to do. I have a 4 sided case labeling printer setting out on one of our production lines. Now then i have a vb.net application that sends data to this printer using a RawPrinterHelper class that i found I believe in the msdn. the class works wonderfully when I send stright text data (in the correctly formated string that the sato printer requires.) but when i go to send a image nothing is...
11
3541
by: Lues | last post by:
Hi, I'm trying to protect some data in tables with encription (you know why, don't you ;)) I must confess that I'm not very expirienced in writing code, especially encription code. Can any one, please , send VB code for access which I can c/p into one function. It don't have to be RSA, it can be anything which is easy to
2
12723
by: RP2001 | last post by:
I've serialized in various variables of various types (mainly CString, int, double) into an instantiated MFC CArchive class and saved it as a binary file. I am able to open the binary file and read out the individual variables fine with an MFC application. However I cannot read the binary file correctly with a C#.NET application, where I'm using the BinaryReader Class. Doing some debugging I noticed that the problem occured at this C#...
1
1204
by: LedZep | last post by:
This program has to use a stack to determine whether a string is a palindrome (a string that is spelled identically backward and forward). The program has to ignore spaces, case sensitivity and punctuation. I have to somehow take the input from the txtbox, stack it letter by letter onto a stack, then display it written forward and below it written backwards. I understand the concept of stacks -- I just need a little push in the right...
1
9652
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
0
2965
by: Lildog | last post by:
I use this code to generate random names for jewelry products I will eventually sell. I found this code on the web and wondered if someone could give a detailed description of each line of code? I want to rewrite it in Revolution and use it as a standalone. Not much code, I think someone who knows perl could blast through it real quick. Thank you much in advance.
66
5414
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it occurs. After the program has read the file, it should offer a menu with three choices. the first is to list all the words along with the number of occurences. The second is to let you enter a word, with the program reporting how many times the...
3
1579
by: JILIAN | last post by:
#include <stdio.h> #include <string.h> #define SIZE 80 int main () { char word; int i; int length =0;
9
2519
by: weidongtom | last post by:
Hi, I've written the code that follows, and I use the function add_word(), it seems to work fine *before* increase_arrays() is called that uses realloc() to allocate more memory to words. But *after* calling increase_arrays(), I received segmentation fault. I tried to step it through gdb, and I found out that after calling increase_arrays(), words's original value is modified, and if I tried to access it, I get <address 0x11 out of...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10103
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9911
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7460
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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 we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.