×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    5

    Cannot create file

    Hello,
    I'm trying to output some text into a new file but the file.open call always returns false.
    Code:
    QFile file("test.txt");
    if(file.open(QIODevice::ReadOnly | QIODevice::Text)){
    	file.write(ui.label->toPlainText().toUtf8());
    	file.close();
    }
    I found the following in the documentation of QFile's open function:
    Note: In WriteOnly or ReadWrite mode, if the relevant file does not already exist, this function will try to create a new file before opening it.
    So I thought it may have something to do with the permissions, and I tried :
    Code:
    file.setPermissions(QFile::WriteOwner);
    But it returns false as well.

    Any idea about how I can create the file ?

    My environment :
    Qt 4.6.2
    Carbide.c++ 2.3.0
    S60 5th Edition SDK v1.0
    winscw emulator

  2. #2
    Regular Contributor
    Join Date
    Oct 2008
    Location
    Oslo, Norway
    Posts
    329

    Re: Cannot create file

    Hi,

    Umm.. you're trying to open the file in ReadOnly mode, and then write to it?

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    5

    Re: Cannot create file

    Quote Originally Posted by treinio View Post
    Hi,

    Umm.. you're trying to open the file in ReadOnly mode, and then write to it?
    No waaay !! I guess this is the kind of things that happen after one spends too much hours in front of the screen !
    Thank you, it works =)

Similar Threads

  1. Not able to create .sis file
    By amit.mangal in forum Symbian
    Replies: 12
    Last Post: 2009-09-23, 13:06
  2. How to create .aif file...??
    By s4sandy_bit in forum Symbian
    Replies: 2
    Last Post: 2008-11-18, 10:27
  3. Problem with GCCE build in Carbide.vs
    By raffaelbechara in forum Symbian
    Replies: 6
    Last Post: 2008-10-20, 16:06
  4. How to create a bmp file from a TDesC.
    By bill-wang in forum Symbian
    Replies: 14
    Last Post: 2008-10-12, 16:24
  5. File server: Compilation error in carbide.c++
    By justteam in forum Symbian
    Replies: 6
    Last Post: 2007-01-03, 23:44

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×