Results 1 to 2 of 2

Thread: How to read record from .hex file to Qbyte Array

  1. #1
    Join Date
    Sep 2020
    Posts
    7
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default How to read record from .hex file to Qbyte Array

    Hi ,

    i have a use case were i have to read byte data from .hex file of size around 4093 bytes to Qbyte array.
    while reading data from file i have to read only 8bytes at a time.

    i am new to Qt.

    how do i achieve this use case?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to read record from .hex file to Qbyte Array

    What is a .hex file? Might be an Intel HEX but could a be a multitude of other things.

    You can slurp the whole file into memory using just QFile and QByteArray. Not sure where the 8-bytes at a time thing is coming from, but you could do that with these classes too.

    If it is actual an Intel HEX file then you could read the lines using QTextStream and pull them apart with the methods in QString. Alternatively, stay at a lower level and use QByteArray and its fromHex() method.

Similar Threads

  1. QVector or 2D Array to read out from a file
    By vitalic in forum Newbie
    Replies: 4
    Last Post: 28th April 2020, 18:44
  2. How to read the content of DNS record?
    By ricardodovalle in forum Qt Programming
    Replies: 5
    Last Post: 7th July 2015, 17:44
  3. read ini file content and save into array
    By cooper in forum Newbie
    Replies: 8
    Last Post: 14th March 2011, 22:33
  4. read a .txt file and store it in a double array
    By fatecasino in forum Newbie
    Replies: 5
    Last Post: 3rd December 2010, 21:13
  5. read from file into array
    By obad in forum Qt Programming
    Replies: 1
    Last Post: 1st August 2010, 09:26

Tags for this Thread

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.