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

Load file problem (urgent)

0 replies · 1,922 views · Started 21 October 2003

Hi, i use the follwing code to load and open a file and save it into a buffer(bufferDes). I have no problem opening the file, but my emulator crashes when it exceeds. I realise that this happen everytime when i try to load a file: Below is the function i use to load the file. Is there any problem or i forgot to close something so it crashes?

TPtr8* CHelloWorldAppView::LoadFile(const TDesC& filename) {
int size=0;
RFs iRFs;
RFile iFile;
TPtr8* bufferDes;

TFileName aPath=BaflUtils:😃riveAndPathFromFullName(
CEikonEnv::Static()->EikAppUi()->Application()->AppFullName());

aPath.Append(filename);

iRFs.Connect();

int temp=iFile.Open(iRFs, aPath, EFileStream);

iFile.Size(size);
bufferDes = new TPtr8(new TUint8[size], size);

iFile.Read(*bufferDes, size);

iFile.Close();
iRFs.Close();
return bufferDes;
}

Hope you can help, i am totally helpless.
Thanks.
zhen