Results 1 to 2 of 2

Thread: QFile, QTextStream

  1. #1
    Join Date
    Dec 2007
    Posts
    28
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default QFile, QTextStream

    Hi

    I have a problem, my program at start creates a txt file, later he is writting something in to this txt file but he is not adding text but overwritting previous line... With this i have all time only 1 line in my txt file, Do u know any function wich ll add text to he next linet?

    Qt Code:
    1. QFile file("out.txt");
    2. if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
    3. return;
    4.  
    5. QTextStream out(&file);
    6. out << temp[0];
    To copy to clipboard, switch view to plain text mode 
    (it is from example)

    Best Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFile, QTextStream

    You have to open that file in "append" mode.

  3. The following user says thank you to jacek for this useful post:

    Zergi (12th January 2008)

Similar Threads

  1. QTextStream + QFile issue
    By trueneo in forum Qt Programming
    Replies: 3
    Last Post: 22nd September 2007, 15:16
  2. Create QTextStream
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 17th June 2007, 20:25
  3. QFile, QTextStream, seek()
    By TheKedge in forum Qt Programming
    Replies: 4
    Last Post: 29th September 2006, 15:07
  4. Qfile and QTextStream
    By sreedhar in forum Qt Programming
    Replies: 1
    Last Post: 28th June 2006, 10:43
  5. QSettings vs (QFile + Qtextstream)
    By nupul in forum Newbie
    Replies: 5
    Last Post: 10th April 2006, 07:26

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.