PDA

View Full Version : displaying binary files



shimek
23rd September 2020, 10:04
Hello, dear users. I have a problem with the code for displaying binary code. I need to compare two files .bin and find differences.
Those places where there are differences should be left, and the remaining values should be replaced with the number 23.
I will be ready for any questions and ready to learn. Don't swear thank you

Stophe
23rd September 2020, 14:08
I wanted to do a pff reader to edit old games, and ended up doing an hexadecimal reader/storer for my thesis, so basically it's the same idea. You can output streams of char and compare them with a function "showHexContent", so it may be a good hint about how to read such files. «ReadFromFile» is the function that reads ... the file, as a vector of char. All data is held in a std::vector<char> buffer.
You can also do your conversions to vectors of floats, char, or customized types, but I assume that's not what you're looking for for now, unless you already have a dedicated class with the good data layout that exactly fits the data of your file, that you could then compare with an operator in C++.

It's currently on developpement, and there are high chances that you encounter bugs if you use it, also, there is a customized header, so you may have to code your own thing to read from the very beginning of the file instead, but that's the most I can do to help ! I hope it's not too badly commented, but I can't do better for the moment, ask questions if you're interressed !
I had to rename HexaParserFunction into .hpp

13546
13548
13549
13551

EDIT: it's command line stuff, but then you just have to display the content into a Widget if you want. Data is already aligned when displayed. Runs on linux for me, may be machine dependent for some stuff.