Удалить dbase index flag

Материал из DRKB

Удалить dbase index flag[править | править код]

function UnCheckIndex(FileDbf: string): Boolean;
var
  Dbf: file;
  Car: Char;
begin
  Result := T;
  AssignFile(Dbf, FileDbf);
  Car := #0;
  {$I-}
  Reset(Dbf, 1);
  if not ErrorIO(FileDbf, IoResult) then
  begin
    Seek(Dbf, 28);
    { Flag's position }
    if not ErrorIO(FileDbf, IoResult) then
      BlockWrite(Dbf, Car, 1, Num_R)
    else
      Result := F;
    CloseFile(Dbf);
    if ErrorIO(FileDbf, IoResult) then
      Result := F;
  end
  else
    Result := F;
  {$I+}
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if UnCheckIndex('MyBase.dbf') then
    ShowMessage('Flag removed');
end;


Source: Взято с сайта http://www.swissdelphicenter.ch/en/tipsindex.php
ID: 02707