Q&A

  • I/O Error 131...
아래 소스에서 에러가 나네요...
알려주셈

<!--CodeS-->
procedure TMainfrm.DeleteRecord;
var
  CurPos, RecordNo, i: integer;
  Buffer: array[0..MAX] of TMyRecord;
begin
  if MessageDlg('정말 지우시렵니까?', mtConfirmation, [mbYes, mbNo], 0) = mrNo
    then Exit;
  if NewRecord then
  begin
    ReadRecord;
    NewRecord := False;
    EnableButtons(True);
    Exit;
  end;
  CurPos := FilePos(MyFile);
  RecordNo := FileSize(MyFile) - CurPos - 1;
  if (FilePos(MyFile) < (FileSize(MyFile) - 1)) then
  begin
    Seek(MyFile, FilePos(MyFile) + 1);
    i := 0;
    while not EOF(MyFile) do
    begin
      Read(MyFile, Buffer[i]);
      Inc(i);
    end;
    Seek(MyFile, CurPos);
    Truncate(MyFile);
    for i := 0 to RecordNo - 1 do
      write(MyFile, Buffer[i]);
    end
    else
    begin
      Truncate(MyFile);
      Dec(CurPos);
    end;
    Seek(MyFile, CurPos);
    ReadRecord;
end;
<!--CodeE-->
0  COMMENTS