[Lazarus] LongString does not work?

Xiangrong Fang xrfang at gmail.com
Sun Mar 3 14:59:23 CET 2013


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

2013/3/3 Bart <bartjunk64 at gmail.com>

> On 3/3/13, Xiangrong Fang <xrfang at gmail.com> 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
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130303/d5346522/attachment-0003.html>


More information about the Lazarus mailing list