
24.09.2016, 19:55
|
Прохожий
|
|
Регистрация: 24.09.2016
Сообщения: 1
Версия Delphi: Delphi Turbo
Репутация: 10
|
|
Чтение из INI файла
Нужна помощь!
Я написал код для записи записи (извините за тавтологию)
Код:
type
lists = record
i,summ:integer;
sroc: real;
pr: array [1..30] of string;
oc: array [1..30] of integer;
fio:string;
end;
...
procedure TOtchForm.BitBtn8Click(Sender: TObject);
var
a,b:integer;
begin
Windows.DeleteFile('C:\123\IniFileName.Ini');
for a := 1 to 20 do
begin
if list[a].fio <> '' then
begin
for b := 1 to 20 do
begin
if list[a].oc[b] <>0 then
begin
IniFile.WriteString(list[a].fio,'Предмет'+inttostr(b),list[a].pr[b]);
IniFile.WriteInteger(list[a].fio,'Оценка'+inttostr(b),list[a].oc[b]);
end;
end;
IniFile.WriteInteger(list[a].fio,'i',list[a].i);
IniFile.WriteInteger(list[a].fio,'Сумма',list[a].summ);
IniFile.WriteFloat(list[a].fio,'Средняя оценка',list[a].sroc);
end;
end;
iniFile.free;
end;
Все записывается правильно. Теперь не знаю как считать
Пробывал так:
Код:
procedure TOtchForm.BitBtn16Click(Sender: TObject);
var
v,p,g:integer;
begin
IniFile.ReadSections(ComboBox1.items);
for v := 1 to ComboBox1.DropDownCount+1 do
begin
for g := 1 to 20 do
begin
list[v].pr[g]:=(IniFile.ReadString(ComboBox1.items[g-1],'Предмет'+inttostr(g), '') );
list[v].oc[g]:=IniFile.ReadInteger(ComboBox1.items[g-1],'Оценка'+inttostr(g), '');
end;
list[v].i:=IniFile.ReadInteger(ComboBox1.items[g-1],'i', '');
list[v].summ:=IniFile.ReadInteger(ComboBox1.items[g-1],'Сумма', '');
list[v].sroc:=IniFile.ReadFloat(ComboBox1.items[g-1],'Средняя оценка', '');
end;
end;
не работает, как починить?
|