Hi,
I have problems finding out how to read and write from/to an app's ini file. I have found out that I need to overrid "OpenIniFileLC" in my app's App class like this:
// ---------------------------------------------------------
// CDictionaryStore* CMyApp::OpenIniFileLC(RFs& aFs) const
// overrides CAknApplication::OpenIniFileLC to enable INI file support
// ---------------------------------------------------------
//
CDictionaryStore* CMyApp::OpenIniFileLC(RFs& aFs) const
{
return CEikApplication::OpenIniFileLC(aFs);
}
But after that I don't know how to for.ex. save the settings from a form. I haven't found any useful information about this, not the actual code needed, nor the class in which the code should be placed. Any heelp is much appreciated ! 😃
Buhu, not a single tiny reply in sight! 😉
Your OpenIniFileLC function returns the 'directory' for the ini file (which is a CDictionaryStore*).
What you now need to do is look in the CStreamDictionary to find the data you're after, so you'll probably want to write a function that calls your new overridden OpenIniFileLC
You can now read from the stream:
[code:1]
TUid theuid;
CDictionaryStore* store = OpenIniFileLC(RFs& aFs);
...
CStreamDictionary instream;
instream.OpenLC(*store,theuid);
TSomeData data //i.e. where you want to store the data your importing;
instream >> data;
CleanupStack::PopAndDestroy();
[/code:1]
The only problem you have is getting a value for the UID - not sure how you'd do that.
Sorry - bit of an half assed answer, but I'm a bit knackered at the moment (hense the many edits to get it this far). Hopefully it will help you at least a little bit (If not, I'll try to put a better description down when I'm a) more with it and b) had a chance to mess with the code myself - It's always easier to work through these things if you've got the compiler open 😃 )[/code]
Hehe, no problem! Thanks for the info you provided! Will play around a bit and see what I will be able to do 😊