Results 1 to 3 of 3

Thread: To store the Qtablewidget data to .csv or xl file - Issue

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2015
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default To store the Qtablewidget data to .csv or xl file - Issue

    The following is my piece of code:

    Qt Code:
    1. QString fileName = appData + DIR+ "AISTABLE";
    2. fileName = fileName + d_local.toString("_yyyy-MM-dd") + t_local.toString("_HH-mm-ss") + ".csv";
    3. f_out = fopen(fileName.toAscii().data(), "wb+");
    4. if (f_out == NULL) {
    5. return;
    6. }
    7.  
    8. QString headerString = "d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11\r\n";
    9.  
    10. for(int row = 0;row <ui->tableWidget->rowCount()-1; row++)
    11. {
    12. for(int column = 0;column< ui->tableWidget->columnCount()-1 ;column++)
    13. {
    14. headerString += ui->tableWidget->item(row,column)->text() +",";
    15. }
    16. headerString += "\r\n";
    17. }
    18. fprintf(f_out,"%s",headerString.toAscii().data());
    19. fflush(f_out);
    20. fclose(f_out);
    To copy to clipboard, switch view to plain text mode 

    I have created the Qtablewidget using Qt designer with rows = 300 and column = 12.
    When I execute the above program, I get the following error:

    Unhandled exception at 0x5463d72c in File.exe: 0xC0000005: Access violation reading location 0x00000000.

    What is the problem for not getting output?
    Last edited by anda_skoa; 28th April 2016 at 16:38. Reason: missing [code] tags

Similar Threads

  1. QVector to store 3d data
    By Vikram.Saralaya in forum Qt Programming
    Replies: 4
    Last Post: 18th November 2015, 16:01
  2. How to store data in a tablemodel
    By rubikon in forum Newbie
    Replies: 11
    Last Post: 13th August 2012, 14:18
  3. Replies: 2
    Last Post: 15th December 2011, 21:57
  4. Best way to store and retrieve contents of QTableWidget?
    By codeslicer in forum Qt Programming
    Replies: 3
    Last Post: 6th April 2008, 09:39
  5. How to store/get pointer on QTreeWidgetItem data?
    By Teerayoot in forum Qt Programming
    Replies: 2
    Last Post: 28th April 2007, 22: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
  •  
Qt is a trademark of The Qt Company.