Вопрос про типизированные файлы в делфи
Записываю и считываю файл вот таким образом:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls, Menus, ExtDlgs;
type
TStudent=record
fam,imya,otch:string[255];
spec1,spec2,spec3:string[255];
ball:integer;
end;
var
Form2: TForm2;
Student:TStudent;
Fi:File of TStudent;
procedure TForm2.N6Click(Sender: TObject);
begin
if SaveDialog1.Execute then
begin
AssignFile(Fi,OpenDialog1.FileName);
Reset(Fi);
Student.fam:=fam;
Student.imya:=imya;
Student.otch:=otch;
Student.spec1:=spec1;
Student.spec2:=spec2;
Student.spec3:=spec3;
Student.ball:=ball;
Write(Fi,Student);
CloseFile(Fi);
end;
end;
procedure TForm3.N2Click(Sender: TObject);
if OpenDialog1.Execute then
begin
AssignFile(Fi,OpenDialog1.FileName);
Reset(Fi);
Memo1.Clear;
while not EOF(Fi) do
begin
Read(Fi, Student);
Memo1.Lines.Add('Фамилия: ' + Student.fam + ' Имя: ' + Student.imya + ' Отчество: ' +Student.otch);
Memo1.Lines.Add('Выбранные специальности: '+Student.spec1+' '+Student.spec2+' '+Student.spec3);
Memo1.Lines.Add('Количество баллов: '+inttostr(Student.ball));
end;
CloseFile(Fi);
end;
и на строчке:
Write(Fi,Student);
выдает ошибку 'I/O error 6'
в чем проблема?