Results 1 to 7 of 7

Thread: Write QBitArray to file with QDataStream

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2011
    Posts
    3

    Default Write QBitArray to file with QDataStream

    Hi, I'm trying to write a QBitArray to file using a QDataStream but I think I may have the syntax wrong.

    This is an example of how I'm doing it.

    Qt Code:
    1. QBitArray test1;
    2. test1.resize(test1.size()+ 4);
    3. test1.setBit(0, true);
    4. test1.setBit(1, false);
    5. test1.setBit(2, true);
    6. test1.setBit(3, false);
    7.  
    8. QFile file ("testFile.data");
    9. file.open(QIODevice::WriteOnly);
    10.  
    11. QDataStream out(&file);
    12.  
    13. out << test1;
    14.  
    15. file.close();
    To copy to clipboard, switch view to plain text mode 
    Last edited by vdsf; 9th September 2011 at 12:52.

Similar Threads

  1. Empty QBitArray problem
    By MarkoSan in forum Qt Programming
    Replies: 1
    Last Post: 21st March 2011, 15:06
  2. Replies: 2
    Last Post: 2nd November 2010, 05:15
  3. Replies: 2
    Last Post: 30th June 2010, 10:48
  4. QFile - QDataStream read and write each character
    By nhs_0702 in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2010, 19:03
  5. QBitArray (the smallest unit of them all)
    By baray98 in forum Qt Programming
    Replies: 3
    Last Post: 29th September 2007, 14:16

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.