Ini File

Login to reply to this topic.
Tue, 2003-08-26 07:28
Joined: 2003-07-22
Forum posts: 70
Can anybody please show me little code for
1 creating INI file
2 reading
3 writing
(Text format)
Thanks
Meenuj

Wed, 2003-08-27 23:51
Joined: 2003-07-09
Forum posts: 17
Re: Ini File
Try this.

void CMyAppUi::ReadIniFileL ()
{
  CDictionaryStore* iniFile=CDictionaryFileStore::SystemLC (iEikonEnv->FsSession ());
  if (iniFile->IsPresentL (KUidUserApp)) {
    RDictionaryReadStream stream;
    stream.OpenLC (*iniFile, KUidUserApp);

    idata=stream.ReadInt32L ();

    CleanupStack::PopAndDestroy ( /* stream */ );
  }
  CleanupStack::PopAndDestroy ( /* iniFile */ );
}

void CMyAppUi::WriteIniFileL ()
{
  CDictionaryStore* iniFile=CDictionaryFileStore::SystemLC (iEikonEnv->FsSession ());
  RDictionaryWriteStream stream;
  stream.AssignLC (*iniFile, KUidUserApp);

  stream.WriteInt32L (iData);

  stream.CommitL ();
  CleanupStack::PopAndDestroy ( /* stream */ );
  iniFile->CommitL ();
  CleanupStack::PopAndDestroy ( /* iniFile */ );
}

Greg
--
Greg Roach, Stony Stratford, Bucks, England, greg@subaqua.co.uk
"Don't eat animals - it's not good for them and they don't like it"
Fri, 2003-08-29 08:22
Joined: 2003-07-22
Forum posts: 70
Ini File
Hi
Thank you very much for the help. It is working fine.

But I wonder where it is storing the data
Can u just tell me in which file the data is stored


Thanks a lot
MeenuJ
Fri, 2003-08-29 08:26
Joined: 2003-07-09
Forum posts: 17
Ini File
: But I wonder where it is storing the data
: Can u just tell me in which file the data is stored

/system/apps/YOUR_APP/YOUR_APP.ini

Greg
--
Greg Roach, Stony Stratford, Bucks, England, greg@subaqua.co.uk
"Don't eat animals - it's not good for them and they don't like it"
Wed, 2003-12-03 16:33
Anonymous (not verified)
Forum posts: 2043
Ini File
Quote from: fisharebest
: But I wonder where it is storing the data
: Can u just tell me in which file the data is stored

/system/apps/YOUR_APP/YOUR_APP.ini

Greg
--
Greg Roach, Stony Stratford, Bucks, England, greg@subaqua.co.uk
"Don't eat animals - it's not good for them and they don't like it"

Doesn't this save your data to the system ini file?! That's supposed to be banned (see KB at Symbiandevnet).

Instead you should open the ini file using CEikApplication::OpenIniFileLC.
Thu, 2003-12-04 00:26
Joined: 2003-07-09
Forum posts: 17
Ini File
: Doesn't this save your data to the system ini file?! That's supposed to be
: banned (see KB at Symbiandevnet).

You are right - it does save it as a stream in the system.ini file.

For ER5, this was the prefered technique.  IIRC, this is how the Word
application does it (source code was supplied with the SDK).
I don't remember for ER6.0, but I think it was still allowed then.

: Instead you should open the ini file using CEikApplication::OpenIniFileLC.

For ER6.1, the functionality was removed from CAknAppUi, so you need
to use CEikAppUi to get it.

For ER7.0 it is there again.

So, it may/may not be the preferred technique, depending on what
platform you are using.

I use it on all platforms, but only to save 16 bytes of data (registration code
and GUI prefs).  It is not the place to store large amounts of data.  This
would need to go into a application specific config file.

Greg
Tue, 2005-03-08 02:50
Joined: 2004-08-19
Forum posts: 112
Ini File
I do it just as described here (using my own .ini, not the system one) or in the books. The problem is that the .ini file gets longer with every start of the program. Peeking into it, it seems that instead of storing the data into the same place, it starts a new stream inside the file each and every time.

Bye,
Gábor

  • Login to reply to this topic.