file is not created on phone(a newbie)

Login to reply to this topic.
Thu, 2005-08-04 09:02
Joined: 2005-08-04
Forum posts: 14
hi
 I'm trying to save an encoded image taken from camera in image folder of phone memory.But file i've tried to create is n't being created.I'm using RFile and RFileWriteStream to create and write my stream into the file.


 Â           DstBuffer = new(ELeave)  unsigned char[sz];
   QwikVuEnc->obsRaw->read((char*)DstBuffer,sz);
   
   RFs         iSession1;
      
   User::LeaveIfError(iSession1.Connect());
   CleanupClosePushL(iSession1);
   RFile  bitmapfile1;
   if(bitmapfile1.Replace(iSession1,(TDesC&)FileName,EFileWrite|EFileStream )!= KErrNone)
      {
 Â       CAknInformationNote* informationNote = new (ELeave)CAknInformationNote;
 Â       informationNote->ExecuteLD(_L("Failed to create file"));
 Â       CleanupStack::PopAndDestroy(); // Close fileSession
 Â       return 0;
 Â       }
   CleanupClosePushL(bitmapfile1);
   
   //   User::LeaveIfError(err);

   
   RFileWriteStream writefile(bitmapfile1);
   CleanupClosePushL(writefile);
   writefile.WriteL(DstBuffer,sz);


   writefile.CommitL();

//   bitmapfile1.Close();
//   iSession1.Close();
   CleanupStack::PopAndDestroy();//Close writefile
   CleanupStack::PopAndDestroy();// Close bitmapfile1
   CleanupStack::PopAndDestroy();// Close iSession1

 Â      Pl anyone help me...
 Â     advance thanks for help..
bye
amit mittal


Thu, 2005-08-04 11:12
Joined: 2003-04-01
Forum posts: 142
Re: file is not created on phone(a newbie)
I think the replace wants to have a file before open it. So what about using create, and just making sure that the file does not exists by deleting it in previous line.

yucca
Thu, 2005-08-04 11:34
Joined: 2004-12-03
Forum posts: 192
Re: file is not created on phone(a newbie)
Replace will create file if it doesn't already exist.
What is the error code reurned by Replace?
  • Login to reply to this topic.