Read-only archive of the All About Symbian forum (2001–2013) · About this archive

c++ class symbian s60 file reading/writing

1 replies · 2,351 views · Started 30 December 2004

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

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,EFileStreamText|EFileWrite|EFileShareAny);
if (err==KErrNotFound) // file does not exist - create it
err=file.Create(fsSession,e3dlog_filename,EFileStreamText|EFileWrite|EFileShareAny);

TBuf8<256> data;

data.Copy(e3dlog_filename);

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

fsSession.Close();