473,387 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 5977

"Paul" <pa********@hotmail.com> wrote in message
news:ca*************************@posting.google.co m...
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********@hotmail.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
10011010100101101011010111100111011010111000110111 01001101011000101111000111
01100111001111100111110100110011010110011010110101 10101011010110100111001011
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********@hotmail.com> wrote in message
news:ca*************************@posting.google.co m...
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
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...
11
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...
2
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...
1
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...
1
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...
0
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...
66
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...
3
by: JILIAN | last post by:
#include <stdio.h> #include <string.h> #define SIZE 80 int main () { char word; int i; int length =0;
9
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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
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...

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.