Error in storing the error code globlly.
| Mon, 2007-08-27 12:49 | |
|
|
Hi can anybody tell me why the following code gives error at run time? Brajesh... Life is too short ! so do as many good things as you can do... |
| Mon, 2007-08-27 12:49 | |
|
|
Hi can anybody tell me why the following code gives error at run time? Brajesh... Life is too short ! so do as many good things as you can do... |
Forum posts: 364
Is your question why does a call to RFile::Create() return an error code, you'll need to show the rest of the code. Or how to store that error code in a global variable? You're question is ambiguous.
Forum posts: 159
class CFileHandler
{
RFile file;
TInt ErrorCode;
public:
void CreateFile(const TDesC& filename);
};
void CFileHandler::CreateFile(const TDesC& filename)
{
ErrorCode=file.Create(fsSession,filename,EFileWrite|EFileStreamText);
}
now i think you would have understand the problem....
when CreateFile function is called the program gives errror....
i want to know why ?
thank you.....for the help....
Life is too short ! so do as many good things as you can do...
Brajesh Kumar...
Beginner in Symbian C++
Forum posts: 214
Have you done fsSession.Connect() somewere before?
"I only know that I know nothing." (Socrates)
Forum posts: 159
Yes...
Life is too short ! so do as many good things as you can do...
Brajesh Kumar...
Beginner in Symbian C++
Forum posts: 124
hi,
can u paste the error so that we can know wht is the reason for the error.
Regards,
Mateen Maldar
Mateen Maldar
Forum posts: 364
How can we know what the reason is when you don't give any information?
If you look at the value of ErrorCode yourself it might help you, but without knowing what value gets returned how are we supposed to know? It might be KErrAlreadyExists which isn't an error at all.
And what are the contents of filename?
Where is the fssession.Connect() call made?
etc.
etc.
Are we clairvoyant?
Forum posts: 82
reframe ur question with more data n come back....
jus a wild guess(as u have not given error code)
1. file already exists...check for it
2. path at which files is to be created doesn't exist, for example if you wanna create in c:\data\temp\myfile.txt then c:\data\temp must be there.. Use BaflUtils::EnsurePathExists() before create....
without more info, this is what i can add.
BR
G;p