سلام.
اشاره گر هم خوبه به نظرم:
function test(
Name: PWideChar;// = 'All';
Famil: PWideChar;// = 'All';
Password: PWideChar// = 'NoSet'
): Boolean;
var
ini: TIniFile;
begin
try
ini := TIniFile.Create('d:\ini.ini');
try
if (Name = nil) then Name := 'All';
if (Famil = nil) then Famil := 'All';
if (Password = nil) then Password := 'NoSet';
ini.WriteString('option', 'Name', Name);
ini.WriteString('option', 'Famil', Famil);
ini.WriteString('option', 'Password', Password);
Result := True;
finally
ini.Free;
end;
except
Result := False;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
if not test('ali',nil,'12345') then
ShowMessage('Error Write file');
end;