[Lazarus] LongString does not work?
Bart
bartjunk64 at gmail.com
Sun Mar 3 14:48:12 CET 2013
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
More information about the Lazarus
mailing list