help with removing hex bytes in visual c sharp

V

VC#user

I am processing a hex dump using VC# and printing out textual data
according to a protocol.
I am getting the hex dump in an array and when i get the end of
message, i start the data processing. but there are some junk bytes
(which is always 24 bytes), which I need to remove.

I tried looking for the junk byte signature(for ex: if present byte is
0x02, present byte + 1 is 0x01 and present byte + 2 is 0x01) then
ignore present byte + 23 and then do the processing, but i am trying
to do an array.clear function which doesnot remove the 24 bytes in the
array insteads assigns null in those locations. how do i progress my
array pointer to say if correct byte is in array[3] and array[4] to
array[28] becomes junk, move array[29] to array[4] in visual c sharp.

please help
 
G

Göran Andersson

VC#user said:
I am processing a hex dump using VC# and printing out textual data
according to a protocol.
I am getting the hex dump in an array

That doesn't make sense, really. A hex dump is text representation of
data in hexadecimal format, but it sounds rather like you are getting a
byte array.
and when i get the end of
message, i start the data processing. but there are some junk bytes
(which is always 24 bytes), which I need to remove.

I tried looking for the junk byte signature(for ex: if present byte is
0x02, present byte + 1 is 0x01 and present byte + 2 is 0x01) then
ignore present byte + 23 and then do the processing, but i am trying
to do an array.clear function which doesnot remove the 24 bytes in the
array insteads assigns null in those locations. how do i progress my
array pointer to say if correct byte is in array[3] and array[4] to
array[28] becomes junk, move array[29] to array[4] in visual c sharp.

A common mistake when reading data from a stream is ignoring the return
value of the Read method and instead use all the data in the buffer. The
result is that you are never sure that you actually read the entire
stream, and you will get garbage data at the end of the buffer.

Might that be the reason why you have garbage data in your dump?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top