Results 1 to 8 of 8

Thread: Read&Writee in file

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2011
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Read&Writee in file

    i want to copy the contents of one file to another file.But using the following code only first line is copied;

    Qt Code:
    1. QFile f("/root/Desktop/n.txt");
    2. f.open(QIODevice::ReadOnly | QIODevice::Text);
    3. QFile f1("nn.txt");
    4. f1.open(QIODevice::WriteOnly | QIODevice::Text);
    5.  
    6. QTextStream in(&f);
    7. QTextStream out(&f1);
    8.  
    9. while(!f.atEnd())
    10. {
    11. in>>q;
    12. out<<q;
    13.  
    14. }
    15. f.close();
    16. f1.close();
    To copy to clipboard, switch view to plain text mode 
    Last edited by high_flyer; 7th February 2011 at 11:54. Reason: code tags

Similar Threads

  1. Read from a file
    By matulik in forum Newbie
    Replies: 4
    Last Post: 26th April 2010, 19:02
  2. How to read a XML file that uses UTF-8?
    By PaladinKnight in forum Newbie
    Replies: 2
    Last Post: 10th April 2010, 13:52
  3. is qt phonon can read realmedia file and divx file
    By fayssalqt in forum Qt Programming
    Replies: 1
    Last Post: 27th January 2009, 15:42
  4. Replies: 1
    Last Post: 20th June 2008, 18:43
  5. Read An Xml File
    By Alienxs in forum Qt Programming
    Replies: 3
    Last Post: 5th January 2007, 00:28

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.