TCFP Tiny Config File Parser - API REFERENCE v0.0.1 PRE-ALPHA

Functions

TCFP_config_data *TCFP_load_config( char *cFilename );

Description

Reads target config file and returns pointer to NULL terminated buffer which contains the config-data. This buffer is used by other functions for retrieving key values.

Return Values

Returns pointer to NULL terminated buffer which includes the config file.
Returns NULL pointer if error occurs.

Example usage

TCFP_config_data *config_data;
config_data = TCFP_load_config( "config.txt" );

TCFP_config_value *TCFP_get_value( const char *config_data,  const char *key,  const char delimiter );

Description

Looks for given key from config-data buffer and returns corresponding value as NULL terminated string. Delimiter must be defined as third argument.

Return Values

Returns pointer to NULL terminated string. If retrieving fails, NULL pointer is returned.

Example usage

TCFP_config_value *config_value;
config_value = TCFP_get_config( config_data, "key", '=' );

void TCFP_free_config_data( TCFP_config_data *config_data );

Description

Frees config data buffer.

Return Values

None

Example usage

TCFP_free_config_data( config_data );

void TCFP_free_config_value( TCFP_config_value *config_value );

Description

Frees config value buffer.

Return Values

None

Example usage

TCFP_free_config_value( config_value );