I was using an INI file, but record make things a lot easier.<br><br><div class="gmail_quote">2013/3/3 Bart <span dir="ltr"><<a href="mailto:bartjunk64@gmail.com" target="_blank">bartjunk64@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 3/3/13, Xiangrong Fang <<a href="mailto:xrfang@gmail.com">xrfang@gmail.com</a>> wrote:<br>
<br>
<br>
> TConfiguration = packed record<br>
> DataFolder: array [0..MaxPathLen] of Char;<br>
> end;<br>
><br>
> worked. My save procedure is:<br>
><br>
> function SaveParams(var Buffer; Count: Integer; FileName: string): Boolean;<br>
> var<br>
> fs: TFileStream;<br>
> begin<br>
> Result := False;<br>
> if not ForceDirectories(ExtractFilePath(FileName)) then Exit;<br>
> try<br>
> fs := TFileStream.Create(FileName, fmCreate);<br>
> try<br>
> fs.Write(Buffer, Count);<br>
> Result := True;<br>
> finally<br>
> fs.Free;<br>
> end;<br>
> except<br>
> end;<br>
> end;<br>
><br>
> It is called on the finalization section of config.pas:<br>
><br>
> SaveParams(cfg, SizeOf(cfg), cfn);<br>
> //cfg is TConfgiruation, cfn is the filename.<br>
><br>
<br>
</div></div>Are you only writing strings (and/or integers and/or booleans) to the<br>
configuration file?<br>
If so, wouldn't it be just easier to use a TIniFile for that?<br>
<span class="HOEnZb"><font color="#888888"><br>
Bart<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
--<br>
_______________________________________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
</div></div></blockquote></div><br>