Error in storing the error code globlly.

Login to reply to this topic.
Mon, 2007-08-27 12:49
Joined: 2007-07-31
Forum posts: 159

Hi can anybody tell me why the following code gives error at run time?
when this function is called. Actually i want to store the error code globlly.
void CFileHandler::CreateFile(const TDesC& filename)
{
ErrorCode=file.Create(fsSession,filename,EFileWrite|EFileStreamText);

}
Please help..
Thank you..

Brajesh...


Life is too short ! so do as many good things as you can do...
Brajesh Kumar...
Beginner in Symbian C++


Tue, 2007-08-28 01:37
Joined: 2004-07-10
Forum posts: 364
Re: Error in storing the error code globlly.

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.

Wed, 2007-08-29 06:51
Joined: 2007-07-31
Forum posts: 159
Re: Error in storing the error code globlly.

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++

Wed, 2007-08-29 07:25
Joined: 2005-02-11
Forum posts: 214
Re: Error in storing the error code globlly.

Have you done fsSession.Connect() somewere before?


"I only know that I know nothing." (Socrates)

Wed, 2007-08-29 07:42
Joined: 2007-07-31
Forum posts: 159
Re: Error in storing the error code globlly.

Yes...


Life is too short ! so do as many good things as you can do...
Brajesh Kumar...
Beginner in Symbian C++

Wed, 2007-08-29 08:00
Forum Nokia Champion
Joined: 2005-08-31
Forum posts: 124
Re: Error in storing the error code globlly.

hi,

can u paste the error so that we can know wht is the reason for the error.

Regards,
Mateen Maldar


Mateen Maldar

Thu, 2007-08-30 01:03
Joined: 2004-07-10
Forum posts: 364
Re: Error in storing the error code globlly.

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?

Thu, 2007-08-30 17:19
Joined: 2007-06-21
Forum posts: 82
Re: Error in storing the error code globlly.

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

  • Login to reply to this topic.