×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    159

    problem in .ini file

    Hello i have an .ini file in the following format...

    [0]
    placename=someplace
    address = someaddress

    [1]
    placename=someplace
    address = someaddress

    when i try to retrieve the placename and address the value is retrieved for the first group (i.e) for [0] but the value is not retrieved for [1] this is my code...


    QSettings setting("C:/my_config_file.ini", QSettings::IniFormat);
    setting.beginGroup("0");
    placename = setting.value("placename", 4711).toString();
    address = setting.value("address", 4711).toString();

    PlaceName.insert( 0,placename );
    Address.insert( 0,address);

    setting.beginGroup("1");
    placename = setting.value("placename", 4711).toString();
    address = setting.value("address", 4711).toString();
    PlaceName.insert( 1,placename );
    Address.insert( 1,address );

    the value is not retrieved for setting.beginGroup("1"); wat i am goin wrong thanks for any replies..

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: problem in .ini file

    Check if calling QSettings::endGroup() before begin another group will work.

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    2

    Re: problem in .ini file

    once u begin the group it should be ended.
    also try
    QString path=QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
    path.append("/settings.ini");
    QSettings settings(path, QSettings::IniFormat);
    settings.beginGroup("0");
    placename = settings.value("placename", 4711).toString();
    address = settings.value("address", 4711).toString();
    QSettings::endGroup();

    PlaceName.insert( 0,placename );
    Address.insert( 0,address);

    settings.beginGroup("1");
    placename = settings.value("placename", 4711).toString();
    address = settings.value("address", 4711).toString();
    PlaceName.insert( 1,placename );
    Address.insert( 1,address );
    QSettings::endGroup();

Similar Threads

  1. def file problem
    By koraykayir in forum Symbian
    Replies: 1
    Last Post: 2010-12-22, 15:10
  2. Replies: 3
    Last Post: 2007-11-17, 10:31
  3. problem with PKG file
    By lauyk001 in forum Symbian
    Replies: 0
    Last Post: 2005-04-01, 11:55
  4. sis file problem
    By songlinhe in forum Symbian
    Replies: 1
    Last Post: 2004-10-21, 10:47
  5. Problem with JAR file and PNG file
    By gilch in forum Mobile Java General
    Replies: 1
    Last Post: 2002-09-19, 09:25

Posting Permissions

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