TBufDataset
snippet in c

TBufDataset

user2003

 if FileExists('demo1.bds') then
    BufDataSet1.LoadFromFile('demo1.bds')
  else
    with BufDataSet1 do
      begin
        CreateDataSet;
        Append;
        Fields[0].Value := 'One';
        Fields[1].Value := 1;
        Fields[2].Value := 1.2;
        Append;
        Fields[0].Value := 'Two';
        Fields[1].Value := 2;
        Fields[2].Value := 2.3;
        Append;
        Fields[0].Value := 'Three';
        Fields[1].Value := 3;
        Fields[2].Value := 3.4;
        Append;
        Fields[0].Value := 'Four';
        Fields[1].Value := 4;
        Fields[2].Value := 4.5;
        Post;
        SaveToFile('demo1.bds');
      end;