IniFileRead
Previous  Top  Next

Prototype

StrValue:=IniFileRead (FileName, strSection, strKey, strDefault)

Description

It reads a value from file with ini extention, to the section and parameter specified.

Parameters

FileName: string that represents an ini file.

StrSection
: string that represents the section of ini file to read.

StrKey
: string that represents the parameter inside the section you need to read.

StrDefault: string that may be returned in case the file doesn't contain the section or the parameter that one is trying to read.
Returned value

StrValue: string that corresponds to the value of the suitable parameter.

Notes

None.

Example

// Check if the file exists
Esistente:=FileExists ('c:\files\file.ini');

// If exists
If Esistente=True 

Then
Begin   
// It reads file contents  
FileImage:=IniFileRead('c:\files\file.ini','images','Name','');  
 
// It open the image.  
Image:=ImgOpen(FileImage,0);  
 
//It executes other operations.  
end;  
//If the file doesn't exists displays a message.
Else ApplicationLog(_CurrentAgent,'Inexistent file);