Writing Ini Files With Api Example code.
Post date: Sep 18, 2010 10:26:55 PM
This example, written by Protocol, allows you to write to ini files using pure api.
Function ReadIni(StrIniPath : pchar; StrSection : pchar; StrItem : pchar; StrDefault : pchar) : String;
var
RetAmount : Integer;
StrTemp : String;
StrRet : string;
begin
SetLength(StrTemp,50);
RetAmount := GetPrivateProfileString(StrSection, StrItem, StrDefault, pchar(StrTemp), 50, StrIniPath);
StrRet := Copy(StrTemp,1,RetAmount);
Result := StrRet;
End;
procedure WriteIni(StrIniPath : pchar; StrSection : pchar; StrItem : pchar; StrText : pchar);
begin
WritePrivateProfileString(StrSection, StrItem, StrText, StrIniPath);
End;