View Full Version : c++ class symbian s60 file reading/writing


shade
30-12-2004, 08:16 PM
hi all

can please give me c++ source for simple class
that implement c++ symbian s60 file reading/writing
i need this for use in my app data managment
i have try to implemnt it by myself but
have stund with problem in creting file on memory card were i have install my app

thanks a lot
shade

shade
31-12-2004, 01:14 PM
thanks to gods
i have solve the problem after reading some examples
here is my code that can read and write data to data file that can be located in app installation path i think it's may be useful to newbie’s


TFileName appFullName = CEikonEnv::Static()->EikAppUi()->Application()->AppFullName();

TParse parse;

//On WINS the application is on the z drive
#ifdef __WINS__
parse.Set(_L("c:"), &appFullName, NULL);
#else
parse.Set( appFullName, NULL, NULL);
#endif

TFileName iPath; // contains application's path

iPath = parse.DriveAndPath();

TFileName e3dlog_filename;

e3dlog_filename.Copy(iPath);

e3dlog_filename.Append(_L("e3dlog.txt"));

RFs fsSession;
RFile file;
TFileText txt_file;

User::LeaveIfError(fsSession.Connect());

TInt err=file.Open(fsSession,e3dlog_filename,EFileStrea mText|EFileWrite|EFileShareAny);
if (err==KErrNotFound) // file does not exist - create it
err=file.Create(fsSession,e3dlog_filename,EFileStr eamText|EFileWrite|EFileShareAny);

TBuf8<256> data;

data.Copy(e3dlog_filename);

file.Write(data);//Write seeks to end of file

fsSession.Close();