I was using an INI file, but record make things a lot easier.

2013/3/3 Bart <[email protected]>

> On 3/3/13, Xiangrong Fang <[email protected]> wrote:
>
>
> >   TConfiguration = packed record
> >       DataFolder: array [0..MaxPathLen] of Char;
> >   end;
> >
> > worked.  My save procedure is:
> >
> > function SaveParams(var Buffer; Count: Integer; FileName: string):
> Boolean;
> > var
> >   fs: TFileStream;
> > begin
> >   Result := False;
> >   if not ForceDirectories(ExtractFilePath(FileName)) then Exit;
> >   try
> >     fs := TFileStream.Create(FileName, fmCreate);
> >     try
> >       fs.Write(Buffer, Count);
> >       Result := True;
> >     finally
> >       fs.Free;
> >     end;
> >   except
> >   end;
> > end;
> >
> > It is called on the finalization section of config.pas:
> >
> > SaveParams(cfg, SizeOf(cfg), cfn);
> > //cfg is TConfgiruation, cfn is the filename.
> >
>
> Are you only writing strings (and/or integers and/or booleans)  to the
> configuration file?
> If so, wouldn't it be just easier to use a TIniFile for that?
>
> Bart
>
> --
> _______________________________________________
> Lazarus mailing list
> [email protected]
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to