Configuration library ConfRead() ConfGetLine()
Programming guideline of WinDom

ConfInquire()

NAME

ConfInquire - read an user variable in the configuration file.

PROTOTYPAGE

int ConfInquire( char *keyword, char *format, ...);

PARAMETERS

keyword:
name of variable to read,

format:
format of value (see below),

...:
address of variables to fill up,

return:
an error code :

-33:
configuration file not found,

-1:
variable not found,

>=0:
number of values read,

DESCRIPTION

ConfInquire() read a variable from the configuration file in the application area is defined or in the Default Settings area if defined. If the variable is not found or if no configuration area addressing the application is not found, the function returns -1.

The syntax of variable definition in the configuration file have the following structure:

         keyword = value[, value[, ...]]
The '[]' notation means an optional argument. The format parameter have a similar syntax than printf(). Possible variable are :

%d:
16-bit integer,

%f:
single real (32-bit),

%c:
a character delimited by a quote ('),

%b:
a boolean variable (true, on, 1, false, off, 0),

%B:
the boolean value in set in a specific bit of the variable (see EXAMPLES),

%s:
a string. The string can be delimited by a double quote charactere (") if the string contains space characters.

%S:
equivalent to %s, it is an obsolet mode but kept for higher compatibility.

EXAMPLES In the WINDOM.CNF file:

     appli.font.name = "Helvetica Bold"
     appli.system.path = C:\APPLI\system\
     appli.window.size = 400,300
     appli.window.sizer = 'S'
     appli.parameters.save = TRUE
     appli.parameters.bubble = TRUE
In the application:

         void InitAppl( void)
         {
             char FontName[33], path[128];
             int width, height;
             char car;
     #		define PARAM_SAVE	0x1
     #		define PARAM_BUBBLE 0x2
             int param;
     
             if( ConfInquire( "appli.font.name", "%s", FontName) != 1)
                 strcpy( FontName, "Times");
             if( ConfInquire( "appli.system.path", "%s", path) != 1)
                 strcpy( path, "");
             if( ConfInquire( "appli.window.size", "%d,%d", &width, &height) != 2)
                 width = height = 200;
             if( ConfInquire( "appli.window.sizer", "%s", &car) != 1)
                 car = 'S';
             ConfInquire( "appli.parameters.save", "%B", &param,   PARAM_SAVE);
             ConfInquire( "appli.parameters.bubble", "%B", &param, PARAM_BUBBLE);
         }
BUGS

See ConfRead().

SEE ALSO

ConfRead(), ConfWrite(), ConfGetLine(), Windom configuration.