×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    3

    How to read ini file

    I develop application and create ini file
    I need function read and write ini for chang value in ini file
    please help me

  2. #2
    Nokia Developer Expert
    Join Date
    Apr 2003
    Location
    Finland
    Posts
    425
    Hello,

    Code:
    void CYourAppUi::ReadIniL () const
    {
        CDictionaryStore* iniFile = Application()->OpenIniFileLC (iEikonEnv->FsSession());
        RDictionaryReadStream readStream;
    
        readStream.OpenLC (*iniFile, Application()->AppDllUid());
    
        TInt8 someValue = readStream.ReadInt8L();
    
        readStream.Close();
    
        CleanupStack::PopAndDestroy(&readStream);
        CleanupStack::PopAndDestroy(iniFile);
    }
    
    void CYourAppUi::StoreIniL () const
    {
            CDictionaryStore* iniFile = Application()->OpenIniFileLC(iEikonEnv->FsSession());
            RDictionaryWriteStream writeStream;
            writeStream.AssignLC(*iniFile, Application()->AppDllUid());
    
            TInt8 someValue = 0x12;
            writeStream.WriteInt8L(someValue);
    
            writeStream.CommitL();
            writeStream.Release();
    
            CleanupStack::PopAndDestroy(&writeStream);
    
            iniFile->CommitL();
            CleanupStack::PopAndDestroy(iniFile);
        }
    }
    These methods are aimed to read/write ini binary format, this means ini-file should not be edited e.g. with notepad in the workstation.

    Br V

  3. #3
    Regular Contributor
    Join Date
    Jun 2007
    Location
    Bangkok
    Posts
    84

    Re: How to read ini file

    Sorry for posting this old thread but I am very confused above code.

    Where is INI filename? What is Full path name of INI file? We don't need to specify INI filename?

    Now, my program use text file for configuration setting(.txt file, read/write text file using RFile) but I think I will change my program to read configuration setting from INI file instead if symbian OS framework supports reading data from INI file.
    Last edited by junmobus; 2008-04-15 at 21:22.
    Sawaddee krab.

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,672

    Re: How to read ini file

    Quote Originally Posted by junmobus View Post
    Sorry for posting this old thread but I am very confused above code.

    Where is INI filename? What is Full path name of INI file? We don't need to specify INI filename?
    Actually I do not know neither, however it would take about 5 minutes to test OpenIniFileL/C in the emulator.

  5. #5
    Registered User
    Join Date
    Nov 2005
    Location
    China
    Posts
    8

    Re: How to read ini file

    Quote Originally Posted by wizard_hu_ View Post
    Actually I do not know neither, however it would take about 5 minutes to test OpenIniFileL/C in the emulator.
    would you or someone else kindly explain reading/writing a ini file in more detail? BTW,why would it take that much to test OpenIniFileL/C in emulator... any other suggestion?
    thanks~
    Man.Ocean
    Stay Hungry.Stay Foolish.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×