INI files

void INI_Free(INI_Section * head)

Free INI data.

Parameters:
  • head -

    INI section data.

GSM_Error INI_ReadFile(const char * FileName, gboolean Unicode, INI_Section ** result)

Reads INI data.

Parameters:
  • FileName -

    File to read.

  • Unicode -

    Whether file shoul be treated like unicode.

  • result -

    Pointer where file will be read.

Return:

Error code

INI_Entry * INI_FindLastSectionEntry(INI_Section * file_info, const unsigned char * section, const gboolean Unicode)

Returns pointer to last INI entry of given section.

Parameters:
  • file_info -

    File data as returned by INI_ReadFile.

  • section -

    Section to scan.

  • Unicode -

    Whether file is unicode.

Return:

Last entry in section.

unsigned char * INI_GetValue(INI_Section * file_info, const unsigned char * section, const unsigned char * key, const gboolean Unicode)

Returns value of INI file entry.

Parameters:
  • file_info -

    File data as returned by INI_ReadFile.

  • section -

    Section to scan.

  • key -

    Name of key to read.

  • Unicode -

    Whether file is unicode.

Return:

Entry value.

int INI_GetInt(INI_Section * cfg, const unsigned char * section, const unsigned char * key, int fallback)

Returns integer value from configuration. The file is automatically handled as not unicode.

Parameters:
  • cfg -

    File data as returned by INI_ReadFile.

  • section -

    Section to scan.

  • key -

    Name of key to read.

  • fallback -

    Fallback value.

Return:

Key value or fallback in case of failure.

gboolean INI_GetBool(INI_Section * cfg, const unsigned char * section, const unsigned char * key, gboolean fallback)

Returns boolean value from configuration. The file is automatically handled as not unicode.

Parameters:
  • cfg -

    File data as returned by INI_ReadFile.

  • section -

    Section to scan.

  • key -

    Name of key to read.

  • fallback -

    Fallback value.

Return:

Key value or fallback in case of failure.

gboolean GSM_StringToBool(const char * value)

Converts value to boolean.

It just takes the string and checks whether there is true/yes/t/y/1 or false/no/f/n/0.

Parameters:
  • value -

    String to parse.

Return:

Boolean value, -1 on failure.

typedef struct _INI_Entry INI_Entry

Private structure holding information INI entry.

typedef struct _INI_Section INI_Section

Private structure holding information INI section.

struct _INI_Entry

Structure used to save value for single key in INI style file

Public Members
INI_Entry * Next

INI_Entry * Prev

unsigned char * EntryName

unsigned char * EntryValue

struct _INI_Section

Structure used to save section in INI style file

Public Members
INI_Section * Next

INI_Section * Prev

INI_Entry * SubEntries

unsigned char * SectionName

Previous topic

Info

Next topic

Keys

This Page