Results 1 to 20 of 21

Thread: How to use a file to setup a QProgressDialog, Thanks

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #19
    Join Date
    Feb 2009
    Location
    Guangzhou,China
    Posts
    89
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to use a file to setup a QProgressDialog, Thanks

    Qt Code:
    1. while(file.pos()<file.size()) //-->
    2. while(in.pos()<file.size())
    To copy to clipboard, switch view to plain text mode 

    Somebody had helped me to solve the problem.


    By the way, it's that any way to reuse output file name and QTextStream name? Such as:
    Qt Code:
    1. if(month!=list.at(0))
    2. {
    3. QFile monthFile(outDirName+QDir::separator()+list.at(0)+".txt");
    4. QTextStream monthOut(&monthFile);
    5. month=list.at(0);
    6. }
    7.  
    8. monthOut<<list.at(0)<<'\t'<<list.at(1)<<'\t'<<list.at(2)<<"\n";
    To copy to clipboard, switch view to plain text mode 

    In my previous standard C++ code, I do it in this way:
    cpp Code:
    1. while(getline(ifile, str))
    2. {
    3. filename = str.substr(0, 6)+".txt";
    4. ofstream ofile(filename.c_str(), ios_base::app);
    5. str.erase(0,10);
    6. ofile << str << endl;
    7. ofile.close();
    8. }
    To copy to clipboard, switch view to plain text mode 

    But I do think that reopen and reclose a file in this way is not a wise choice. But i can not work out a better method.

    There are lots of problem to learn in practical experiment. Thanks sincerely to all the friends help me.
    Last edited by wysota; 22nd February 2009 at 07:54. Reason: missing [code] tags

Similar Threads

  1. Apparent error in QtCore/quuid.h
    By cwp500 in forum Qt Programming
    Replies: 11
    Last Post: 18th December 2008, 20:51
  2. Can you specify a file engine?
    By skimber in forum Qt Programming
    Replies: 2
    Last Post: 18th September 2008, 15:54
  3. Set up the Qt4.3.2 with Visual Studio 2005
    By lamoda in forum Installation and Deployment
    Replies: 6
    Last Post: 30th January 2008, 06:51
  4. file renaming on windows
    By jdd81 in forum Qt Programming
    Replies: 9
    Last Post: 2nd October 2007, 19:41
  5. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21

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.