System.IniFiles.TCustomIniFile.ReadInteger
Delphi
function ReadInteger(const Section, Ident: string; Default: Integer): Integer; virtual;
C++
virtual int __fastcall ReadInteger(const System::UnicodeString Section, const System::UnicodeString Ident, int Default);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.IniFiles.pas System.IniFiles.hpp |
System.IniFiles | TCustomIniFile |
Description
Retrieves an integer value from an .ini
file.
Call ReadInteger to read an integer value from an .ini
file. Section
identifies the section in the file that contains the desired key. Ident
is the name of the key (identifier) from which to retrieve the value. Default
is the integer value to return if the:
- Section does not exist
- Key does not exist.
- Data value for the key is not assigned.
Tip: ReadInteger can read and interpret C-style hexadecimal integers that are present in the
.ini
file.
For instance, if you have the following .ini
file contents:
[MySection] MyID1=0x16
then the following call to ReadInteger returns 22
.
var
IniFile: TIniFile;
begin
ShowMessage(IniFile.ReadInteger('MySection', 'MyID1', 0));
end;
See Also
- System.IniFiles.TCustomIniFile.ReadBool
- System.IniFiles.TCustomIniFile.ReadDate
- System.IniFiles.TCustomIniFile.ReadDateTime
- System.IniFiles.TCustomIniFile.ReadFloat
- System.IniFiles.TCustomIniFile.ReadString
- System.IniFiles.TCustomIniFile.ReadTime