[SDL] SDL_Config

Edward Byard e_byard at yahoo.co.uk
Tue May 8 02:51:33 PDT 2007


Hi

Does anyone on here use the SDL_Config library? I'm running version 0.5, and I have a few problems...

I can read from the file with no problems, getting data from whichever variables I have in my config file.

I cannot write new values to the variables (aka. "keys" in SDL_config-speak). I write the value, the CFG_WriteInt function returns 1 (OK)
but then saving the file and closing it totally wipes all contents of the file, leaving me with a 0 byte size file..... :-(

Here is my code:

    CFG_File setupFile;
    int SettingsConfig = CFG_OpenFile("settings.txt",&setupFile);
    if ((SettingsConfig==CFG_ERROR) || (SettingsConfig==CFG_CRITICAL_ERROR))
    {
        // Serious error - quit!
    }
    if (CFG_SelectGroup("Group1",0)==CFG_OK)
    {
        Variable1 = CFG_ReadInt("Item1",1);
         // Works OK 
         CFG_WriteInt("Item1",5);
        CFG_SaveFile("settings.txt",0,0);
    }
    CFG_CloseFile(&setupFile);

    // File is now 0 bytes!!! empty!!


Can anyone help?

Many Thanks!




		
___________________________________________________________ 
What kind of emailer are you? Find out today - get a free analysis of your email personality. Take the quiz at the Yahoo! Mail Championship. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070508/346d119f/attachment.htm 


More information about the SDL mailing list