Hi, I'm very new to symbian c++ (I have been using j2me a lot!) and I've been following a lot of tutorials and I'm still confused about when I need to deallocate certain objects. Here is my program. I'm trying to write the WLan mac address to a text file. And it never creates the file because of a Memory Alloc: error.
Please help me determine which objects I need to be pushing/popping/etc.Code:#ifdef __GCCE__ #include <staticlibinit_gcce.h> #endif #include <f32file.h> #include <e32std.h> #include "main.h" LOCAL_C void mainL(CConsoleBase* con) { _LIT(KTxtHello, "Hello.\n"); _LIT(KTxtError,"Error.\n"); //con->Printf(KTxtHello); TBuf8<20> address; RProperty::Get(KPSUidWlan,KPSWlanMacAddress,address); TBuf<20> wlanMACAddress; for ( TInt i = 0; i < address.Length(); i++ ) { TUint16 addbyte = address[i]; wlanMACAddress.AppendFormat(_L("%02X:"), addbyte); } if ( wlanMACAddress.Length() ) // remove trailing ':' { wlanMACAddress.Delete(wlanMACAddress.Length()-1, 1); } HBufC8* hBuf = HBufC8::NewL(20); hBuf->Des().Copy(wlanMACAddress); TPtr8 myPtr = hBuf->Des(); RFs fs; RFile file; fs.Connect(); file.Replace(fs,_L("C:\\System\\apps\\Image\\address.txt"),EFileWrite); file.Write(myPtr); // add some more data, if needed file.Close(); fs.Close(); }
Thank you in advance.



