Results 1 to 2 of 2

Thread: displaying binary files

  1. #1
    Join Date
    Sep 2020
    Posts
    3
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default displaying binary files

    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
    Attached Images Attached Images
    • File Type: png 1.PNG (26.2 KB, 3 views)

  2. #2
    Join Date
    Jul 2020
    Posts
    9
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt5

    Default Re: displaying binary files

    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

    HexaParser.cpp
    HexaParserFunctions.cpp
    HexaParserFunctions.h
    HexaParser.h

    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.
    Last edited by Stophe; 23rd September 2020 at 15:14.

  3. The following user says thank you to Stophe for this useful post:

    shimek (24th September 2020)

Similar Threads

  1. reading String from binary files
    By sajastu in forum Qt Programming
    Replies: 1
    Last Post: 15th January 2015, 23:16
  2. Binary files and conversion
    By timmu in forum Qt Programming
    Replies: 27
    Last Post: 11th December 2012, 12:19
  3. Reading Binary Files
    By archanasubodh in forum Newbie
    Replies: 1
    Last Post: 27th February 2008, 13:31
  4. How can I read Binary files with Qt
    By geo_saleh in forum Qt Programming
    Replies: 2
    Last Post: 16th August 2007, 11:37
  5. Concatenating two binary files
    By nbkhwjm in forum Newbie
    Replies: 13
    Last Post: 23rd April 2007, 04:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.