Results 1 to 2 of 2

Thread: How to save hex format to file?

  1. #1
    Join Date
    Oct 2013
    Location
    VietNam
    Posts
    41
    Thanks
    3
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Windows Android

    Question How to save hex format to file?

    Hi!
    I need save hex format, but I don't know how to do it
    I have try code but it does not correct
    Qt Code:
    1. QString filename;
    2. filename ="./data.hex";
    3. QFile file(filename);
    4. QByteArray frame_data;
    5. frame_data.append("D1A0A0FF");
    6. QByteArray frame_convert;
    7. frame_convert = QByteArray::fromHex(frame_data);
    8.  
    9. if(file.open(QFile::WriteOnly)){
    10. QDataStream out(&file);
    11. out<< frame_convert;
    12. }
    To copy to clipboard, switch view to plain text mode 
    have solution for this?
    thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to save hex format to file?

    Why are you using a QDataStream?

    Cheers,
    _

Similar Threads

  1. Format XML file
    By vikuseth in forum Newbie
    Replies: 6
    Last Post: 21st December 2012, 08:16
  2. Replies: 5
    Last Post: 1st June 2011, 08:28
  3. Replies: 0
    Last Post: 21st July 2010, 10:32
  4. How to save graphics as dxf format
    By soumya in forum Qt Programming
    Replies: 4
    Last Post: 31st December 2009, 20:32
  5. Save pictures in JPEG format into QDataStream
    By Eos Pengwern in forum Qt Programming
    Replies: 2
    Last Post: 31st December 2009, 13:14

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.