Results 1 to 2 of 2

Thread: Is it not possible to read and write into a text resource file?

  1. #1
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Is it not possible to read and write into a text resource file?

    Hi there guys, I've added 4 text files as resource files to my program, but the files wont open. I would like to read and write on three of these file and "append" on the forth. Here is my code below where I try to open the file.
    Qt Code:
    1. QFile sourcedTenders_file(":/cpt_rcs/App_Resources/cpt/Current_Sourced_Tenders.txt"); //contains urls for sourced tenders.
    2. if(!sourcedTenders_file.open(QFile::ReadWrite | QFile::Text))
    3. {
    4. QMessageBox msgBox_2;
    5. msgBox_2.setText("Url File could not open for reading...");
    6. msgBox_2.exec();
    7. }
    8. QTextStream in_stream(&sourcedTenders_file);
    To copy to clipboard, switch view to plain text mode 

    And I have attached a picture below of where the files are situated in the file tree.filetree.PNG

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Is it not possible to read and write into a text resource file?

    Files in resources (compiled into the program) are READ ONLY.

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

    ayanda83 (28th January 2017)

Similar Threads

  1. Replies: 7
    Last Post: 5th February 2014, 12:20
  2. Write resource file
    By Merylin in forum Qt Programming
    Replies: 2
    Last Post: 13th September 2011, 00:45
  3. Replies: 2
    Last Post: 2nd November 2010, 06:15
  4. file read & write help....
    By aj2903 in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2008, 12:58
  5. structures to a file (read and write)
    By baray98 in forum Qt Programming
    Replies: 5
    Last Post: 10th February 2008, 21:12

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.