Let me get this straight: Is your input file like you showed in
your original post: 2-hex-digit byte values separated by spaces?
Or is it just a continuous stream of 2-hex-digit byte values?
Looks like you have the first thing (but my previous post gave
index values assuming the second).
Now, for the program:
You have the following
[code]
while(!Log.eof()) {
Log.getline(RawPacket,150);
}
Now, I have no way of knowing this, but if the input file has a
newline at the end of the bytes, then the first time through the
loop, getline() returns after the newline is encountered, so the
eof flag is not set, and it goes through the loop again (which
probably overwrites the first byte in the buffer with '\0').
I suggest that you declare RawPacket to have a size greater than
the maximum file size (which is not too large, since there can
be no more than 255 bytes in the body).
Then don't do the loop.
The place where you have real work remaining is the following:
Code:
INSLength = RawPacket[8,9];
Now RawPacket is a one-dimensional array, so the thing in the []
brackets must be an integer.
In C (and C++) the comma is a sequencer: so the expression "8,9" has
value equal to 9.
You must use the two ascii values to calculate a numerical value
for the length (I pretty much indicated how you might do such a
thing in a previous post.)
Dave