Results 1 to 5 of 5

Thread: i can write to a file using QFile, but can not do it using QFile *, why?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default i can write to a file using QFile, but can not do it using QFile *, why?

    hello, i was creating a basic and create a private QFile * and QTextStream * in my class because i wanted to use them inside slots, but i realized that i was able to open, read and even create files but was not able to write to them, after some tests i decided to use a QFile inside every slot (read the file and write contents into a QTextEdit when a button is pressed, save the file when other button is clicked, etc) that is just used inside the function and then deleted, and i were able to write to files using the QFile, but not the QFile *, i will contine using QFile but i want to know why i cant write to files using a QFile *, thanks

  2. #2
    Join Date
    Apr 2011
    Posts
    61
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: i can write to a file using QFile, but can not do it using QFile *, why?

    If you use QFile*, you're declaring a pointer, you need to use "new QFile()" to it works.
    And open it with the option for writing ^^

Similar Threads

  1. How to write in a QFile
    By gorka_sm in forum Newbie
    Replies: 2
    Last Post: 5th May 2011, 12:08
  2. Read and Write file to/from QFile
    By ruben.rodrigues in forum Qt Programming
    Replies: 1
    Last Post: 31st March 2011, 14:57
  3. Replies: 1
    Last Post: 11th October 2010, 10:21
  4. QFile write and file modyfication time
    By Talei in forum Newbie
    Replies: 1
    Last Post: 9th May 2010, 20:46
  5. Unable to write to file QFile
    By cuter in forum Qt Programming
    Replies: 4
    Last Post: 15th July 2009, 11:19

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.