Raised This Month: $12 Target: $400
 3% 

KeyValues with unknown Key's


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
HSFighter
Veteran Member
Join Date: Aug 2007
Location: Flensburg - Germany
Old 08-07-2014 , 05:51   KeyValues with unknown Key's
Reply With Quote #1

Hi all,

i want to read all values from a config file via "KeyValues".
But the Key's are unknow.

It's no problem when i know the name of the "key" but i didn't.

Example:

Code:
"MyFile"
{
    "de_dust"
    {
        "Key_fvj"           "Value_arhu"
        "Key_fgaz"          "Value_mpai"
        "Key_sae"          "Value_uusj"
        "Key_diugx"         "Value_yjko"

    }
    "de_dust2"
    {
        "Key_abc"           "Value_afdu"
        "Key_fguz"          "Value_msai"
        "Key_sqae"          "Value_ddsj"
        "Key_diegx"         "Value_ejko"
    }
}
PHP Code:
public bool:ReadFile(const String:value[], maxlength
{    
    
decl String:map[64];
    
GetCurrentMap(mapsizeof(map));

    
kv CreateKeyValues("Myfile");
    
FileToKeyValues(kvpath);
    
    if (!
KvGotoFirstSubKey(kv)) 
    {
        
LogMessage("CFG File not found");
        
        
CloseHandle(kv);
        return 
false;
    }
    do 
    {
        
KvGetSectionName(kvbuffersizeof(buffer));
        if (
StrEqual(buffermap))
        {            
            
// Here i dount know the "Key"
            
KvGetString(kv"Key_???"Valuemaxlength);
            
CloseHandle(kv);
            return 
true;            
        }
    }while (
KvGotoNextKey(kv));
    
CloseHandle(kv);
    return 
true;  

I want to save all key's and values to an Array.

Code:
E.x. de_dust:

Array[0][0] = Key_fvj
Array[0][1] = Value_arhu

Array[1][0] = Key_fgaz
Array[1][1] = Value_mpai

...
Can someone tell me how i can realize it?

Thanks for the effort.
__________________



Sorry for my very bad english
Greetings HSFighter

Last edited by HSFighter; 08-07-2014 at 05:55.
HSFighter is offline
Send a message via ICQ to HSFighter
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode