Hello to all in forum,
I'm newbie in C/C++, I would like to have some help from you experts.
May you give some example in how to search in C or C++ a hexadecimal patterns within a binary file.
For example:
String1: Then, once found, extract those 3 bytes and the next 11 bytes (14 bytes in total).
Finally, from those 14 bytes, print without spaces "bytes 1 to 6", "bytes 6 to 12", and byte "13 to 14".
Then I would like to print last 2 bytes (13 to 14) joined in decimal format.
The output without any conversion would be:
Code:
446507c90688 888000800005 0015
4465072ec918 059173495269 002C
44650700cc01 01811bc90b00 00AB
But the output converting to decimal the last 2 bytes would be:
Code:
446507c90688 888000800005 21
4465072ec918 059173495269 44
44650700cc01 01811bc90b00 171
The sample file is attached, and looks like this:
Code:
06 00 00 80 00 00 00 80 09 3c c9 06 88 88 80 00
80 00 44 65 07 c9 06 88 88 80 00 80 00 05 00 15
37 06 01 00 00 01 00 65 00 00 00 02 00 00 02 00
18 00 00 00 03 00 00 03 00 17 00 00 00 04 00 00
04 00 01 00 00 00 05 00 00 05 00 15 00 00 00 0a
00 ff ff 00 65 00 00 44 65 07 2e c9 18 05 91 73
49 52 69 00 2C ff ff ff 00 cb 41 04 72 23 01 ff
ff ff 00 01 03 ca 03 08 08 fe cb 0a 00 00 00 00
00 44 65 07 00 cc 01 01 81 1b c9 0b 00 00 AB 55
01 11 04 b1 7f ff ff ff ca 06 00 00 00 00 00 00
Thanks for any help or suggestion.