Fandom

Delphi Programming

Typed file

2,918pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

type
  TDataType = extended;
  TDataTypeFile = file of TDataType;
procedure _write_data(var F: TDataTypeFile);
begin
  ptr_node:= ptr_list^.fNext;
  if ptr_node = nil then EXIT;
  repeat
    Write(F, ptr_node^.fData);
    ptr_node:= ptr_node^.fNext;
  until ptr_node = nil;
end;
Function TSplitList.SaveToFile(const FileName: string): boolean;
var
  f: TDataTypeFile;
begin
  result:= TRUE;
  AssignFile(F, FileName);
  try
    Rewrite(F);
    try
      _write_data(F);
    finally
      CloseFile(F)
    end;
  except
    result:= FALSE;
    raise EListError.Create(C_ERR_SAVE +UpperCase(FileName));
  end;
end;{ SaveToFile }
Procedure TSplitList.read_data(var F: TDataTypeFile);
begin
  try
    Read(F, tmp_dat);
    Clear(lst_splitter);
    Add(tmp_dat);
    repeat
      Read(F, tmp_dat);
      Add(tmp_dat);
    until EOF(F);
  except
    raise EListError.CreateFmt(C_ERR_READ, [FCOUNT -1]);
  end;
end;
Function TSplitList.LoadFromFile(const FileName: string): boolean;
var
  f: TDataTypeFile;
begin
  result:= TRUE;
  AssignFile(F, FileName);
  try
    Reset(F);
    try
      read_data(F);
    finally
      CloseFile(F)
    end;
  except
    result:= FALSE;
    raise EListError.Create(C_ERR_LOAD +UpperCase(FileName));
  end;
end;{ LoadFromFile }

--NNN nmanca 19:49, 13 August 2008 (UTC)

Also on Fandom

Random Wiki