IniFile

Int_GetKeyString, Int_GetKeyValue, Int_SetKeyString, Int_SetKeyValue

Int_GetKeyString

Description 

INT Int_GetKeyString(
   char *Int_Filename,
   char *int_section,
   char *int_key,
   char *int_buffer,
   int  int_maxlength
);

This function retrieves a string from the specified section in the specified file and stores it in a buffer.

Parameters

char *Int_Filename

Address of the filename.

char *int_section

address of section If it is NULL (0), Int_GetKeyString returns name of first section.

char *int_key

address of entry If it is NULL (0), Int_GetKeyString returns name of first entry.

char *int_buffer

address of buffer to be filled

int int_maxlength

size of destination buffer

Return Values

INT

//Int_GetKeyString example - this example manages user libraries.   
char      filename[256],section[256],key[256],buf[2048];
char      caption[256],out[4096],library[256];
int       retval,qw,xs,ys,w,h;
strcpy(caption,"API Example - Int_GetKeyString function");
Int_CreateTextWindow(caption,0,RGB(0,0,128),RGB_WHITE,100);
Get_Size(SIZE_PICWND,&xs,&ys,&w,&h);
strcpy(section,"User");
strcpy(key,"load");
Get_Filename(FILE_CONFIG,filename);
again:
qw=Int_Question("API","Select action:","Check for user libraries","Add new library","Edit inifile","Exit",1,0);
if(qw==1)
   {
   Int_GetKeyString(filename,section,key,buf,2048);
   sprintf(out,"You are currently using these libraries:\n\n%s","buf");
   Int_CreateWindow(WND_1,"API",WP_TOPLEFT,0,0,w,(h/4)-5,out,1,1,0.00000,1,1,1,"Arial,B,9");
   }
if(qw==2)
   {
   Int_GetKeyString(filename,section,key,buf,2048);
   Int_SetWindowState(WND_1,WS_DESTROY);
   retval = SelectFile(library, "Aplication extensions|*.dll", FALSE);
   if(retval == FALSE) goto again;
   if(strcmp(buf,""))
   sprintf(out,"%s,%s","buf,library");
   else
   strcpy(out,library);
   Int_SetKeyString(filename,section,key,out);
   Int_Query("API Example","\n    Please, reboot the application to apply changes.     \n","OK");
   while(!Int_QueryPressed);
   }
if(qw==3)
   {
   Int_SetWindowState(WND_1,WS_DESTROY);
   EditFile(filename);
   }
if(qw==4)
   goto end;
goto again;
end:
Int_SetWindowState(WND_1,WS_DESTROY);
Int_CloseTextWindow();

See Also 
Int_GetKeyValue, Int_SetKeyValue, Int_SetKeyString

Int_GetKeyValue

Description 

double Int_GetKeyValue(
   char *Int_Filename,
   char *int_section,
   char *int_key,
   char *int_defaultvalue
);

This function retrieves a value of the specified key from the specified section in the specified file.

Parameters

char *Int_Filename

Address of the filename.

char *int_section

Address of section If it is NULL (0), Int_GetKeyValue retrieves name of first section. If this name is valid number, function returns it, else it returns 0.

char *int_key

address of entry If it is NULL (0), Int_GetKeyValue retrieves name of first entry...if this name is valid number, function returns it, else it returns 0.

char *int_defaultvalue

This value is returned by Int_GetKeyValue, when the specified key cannot be found.

Return Values

double

See Also 
Int_SetKeyValue, Int_GetKeyString, Int_SetKeyString

Int_SetKeyString

Description 

INT Int_SetKeyString(
   char *Int_Filename,
   char *int_section,
   char *int_key,
   char *int_buffer
);

This function copies a character string into the specified key of the specified section in the specified file.

Parameters

char *Int_Filename

Address of the filename.

char *int_section

Address of section If the specified section doesn't exist, it is created.

char *int_key

address of entry If the specified key doesn't exist, it is created. If it is NULL (0), whole section is deleted!

char *int_buffer

string to be copied

Return Values

INT

See Also 
Int_GetKeyString, Int_GetKeyValue, Int_SetKeyValue

Int_SetKeyValue

Description 

INT Int_SetKeyValue(
   char *Int_Filename,
   char *int_section,
   char *int_key,
   char *int_defaultvalue
);

This function copies a value into the specified key of the specified section in the specified file.

Parameters

char *Int_Filename

Address of the filename.

char *int_section

Address of section If the specified section doesn't exist, it is created.

char *int_key

address of entry If the specified key doesn't exist, it is created. If it is NULL (0), whole section is deleted!

char *int_defaultvalue

Value to be copied.

Return Values

INT

See Also 
Int_GetKeyValue, Int_SetKeyString, Int_GetKeyString