manipulating configuration file
Posted: 13 Aug 2010 18:05
Hello,
I'm working on C++/Linux.
I'm looking for a code example to load an user configuration file.
I found this code in src/config/file.c but I have questions:
1) what does "obj" represent ?
2) is there a simple method taking a file name as input and giving a kind of config object as output ?
Thanks in advance,
Fabien
I'm working on C++/Linux.
I'm looking for a code example to load an user configuration file.
I found this code in src/config/file.c but I have questions:
Code: Select all
/**
* Get the user's configuration file
*/
static char *config_GetConfigFile( vlc_object_t *obj )
{
char *psz_file = var_CreateGetNonEmptyString( obj, "config" );
var_Destroy( obj, "config" );
if( psz_file == NULL )
{
char *psz_dir = config_GetUserDir( VLC_CONFIG_DIR );
if( asprintf( &psz_file, "%s" DIR_SEP CONFIG_FILE, psz_dir ) == -1 )
psz_file = NULL;
free( psz_dir );
}
return psz_file;
}
2) is there a simple method taking a file name as input and giving a kind of config object as output ?
Thanks in advance,
Fabien