Results 1 to 12 of 12

Thread: Write one value per line in text file

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Write one value per line in text file

    Quote Originally Posted by wysota View Post
    What is the point of lines 9 and 10 in the above code?
    No point for lines 9 and 10 actually. Can be removed.


    Added after 4 minutes:


    Quote Originally Posted by BalaQT View Post
    ...
    may i know , what is the type of Results?
    Results is a public member of class clResults in this scope :

    Qt Code:
    1. public :
    2. clResults Results;
    To copy to clipboard, switch view to plain text mode 


    Added after 12 minutes:


    Quote Originally Posted by wysota View Post
    Qt Code:
    1. #include <QtCore>
    2.  
    3. int main(){
    4. QFile f("res.txt");
    5. f.open(QFile::WriteOnly|QFile::Truncate|QFile::Text);
    6. QTextStream str(&f);
    7. list << "abc" << "def" << "ghi";
    8. foreach(const QString &s, list){
    9. str << s << endl;
    10. }
    11. return 0;
    12. }
    To copy to clipboard, switch view to plain text mode 
    Your code as above works fine. It can do what I want. Thank you so much for the useful post.
    Last edited by babygal; 1st December 2010 at 06:47.

Similar Threads

  1. How to write ByteArray into a text file?
    By babygal in forum Newbie
    Replies: 4
    Last Post: 11th October 2010, 04:19
  2. Remove a line in a text file
    By jaca in forum Newbie
    Replies: 1
    Last Post: 18th March 2010, 22:13
  3. How to read line number in a text file
    By grsandeep85 in forum Qt Programming
    Replies: 7
    Last Post: 31st July 2009, 09:09
  4. How to write something in line of txt file
    By Zergi in forum Qt Programming
    Replies: 2
    Last Post: 24th December 2007, 10:02
  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.