Как в последнем случае получить логин и пароль?
Например:
iniFiles
- Код: Выделить всё
- function TCustomIniFile.ReadInteger(const Section, Ident: string; Default: Longint): Longint;
 var
 s: string;
 begin
 Result := Default;
 s := ReadString(Section, Ident, '');
 if s > '' then try
 // convert hex string
 if Pos('0X', UpperCase(s)) = 1 then
 s := '$' + Copy(s, 3, Length(s) - 2);
 Result := StrToInt(s);
 except
 on EConvertError do
 else raise;
 end;
 end;
StrToInt делегирует свою функцию val + добавляет обработку исключений
- Код: Выделить всё
- function StrToInt(const S: string): integer;
 var Error: word;
 begin
 Val(S, result, Error);
 if Error <> 0 then raise EConvertError.createfmt(SInvalidInteger,[S]);
 end;
А val в свою очередь обрабатывает шестнадцатеричные числа начинающиеся на 0x
Следовательно TCustomIniFile.ReadInteger упрощается до:
- Код: Выделить всё
- function TCustomIniFile.ReadInteger(const Section, Ident: string; Default: Longint): Longint;
 begin
 // val, and therefore StrToInt support hex numbers prefixed with 0x
 Result := StrToInt( ReadString(Section, Ident, '') );
 end;






 .
.

