Results 1 to 2 of 2

Thread: Appending data, if file exists.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2015
    Posts
    66
    Thanks
    10
    Thanked 17 Times in 17 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Appending data, if file exists.

    Qt Code:
    1. if(ui->checkBox->isChecked())
    2. {
    3. filename = QFileDialog::getSaveFileName(...);
    4. file = new QFile(filename);
    5. file->open(QIODevice::Append | QIODevice::Text))
    6. {
    7. qDebug() << "File opened in append mode" << filename;
    8. }
    9. }
    10.  
    11. if(!ui->checkBox->isChecked())
    12. {
    13. QTextStream fout(file);
    14. fout << '\n' << '\n' << '\n';
    15. file->close();
    16. }
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to Vikram.Saralaya for this useful post:

    rookee (10th December 2015)

Similar Threads

  1. Appending data to the buffer of a QAudioOutput
    By PLM in forum Qt Programming
    Replies: 6
    Last Post: 19th August 2013, 03:01
  2. Replies: 2
    Last Post: 21st February 2011, 14:52
  3. Appending text to a file
    By janus in forum General Programming
    Replies: 8
    Last Post: 25th March 2009, 11:23
  4. data is not appending to the file
    By sudheer in forum Qt Tools
    Replies: 2
    Last Post: 3rd April 2008, 12:39
  5. Replies: 2
    Last Post: 17th November 2006, 11:25

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.