Cannot open, create or replace file ( s60 3rd ed )
| Fri, 2007-01-05 16:24 | |
|
Here is my code
Code: RFs iFs; RFile iFile; TInt aStatus=0; iFs.Connect(); aStatus = iFile.Replace(iFs, _L("filename"), EFileWrite); iFile.Close(); iFs.Close(); In all contexts (replace 'Replace' with 'Open' or 'Create' ...) it turns out that aStaus=-12. (System wide errorcode which ways that the path cannot be found) I belive that a file in my apps private directory will be created, but only an error occurs..... Magnus |
|






Forum posts: 2006
(should be the full path to your private directory and the filename)
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 25
Now I try this:
RFile iFile;
TInt aStatus=0;
TBuf<256> filepath;
iFs.PrivatePath(filepath); // NOTE
filepath.Append(_L("filename.txt")); // NOTE
iStatus = iFile.Replace(iFs, filepath, EFileWrite);
but 'iStatus' still has the value -12 after iFile.Replace(...);
Forum posts: 58
Check whether the path is correct by printing it...If you have any spelling mistakes in the path you will get the -12 error....
Regards,
peter
Forum posts: 276
And RFile::Replace wants the directory to be present before creating the file.
Therefore I suspect that the private directory is not created in your case. By default no private directory is created. You have to copy any file (in case of an installation) in the private folder or you have to manually(or programaticaly) create it.
In emulator just run your program after creating the directory.
Cheers
Dennis
Today is a gift by GOD, that's why it is called the present.
Forum posts: 25
I realized that the problem was that the diretory dint exist late saturday.
----> the most stupid lack of understanding takes longest time conquer <----