Re: Writing Binary Files with TFileStream
- From: "Robert Kilroy" <kilroy@xxxxxxxxx>
- Date: 22 Nov 2005 11:21:57 -0800
Correction on the WRITE function:
var
FS : TFileStream;
i : Integer;
l : LongInt;
x, e : Word;
brwFieldID, brwValue : String;
begin
try
if FileExists(fname) then
FS := TFileStream.Create(fname, fmOpenWrite)
else
FS := TFileStream.Create(fname, fmCreate);
for i := 0 to tData.Count - 1 do
begin
brwFieldID := tData.Names[i];
brwValue := tData.ValueFromIndex[i];
x := StrToInt(brwFieldID);
FS.Write(x, SizeOf(x));
l := length(brwValue);
FS.Write(l, SizeOf(l));
FS.Write(brwValue[1], l);
end;
e := $FFFF;
FS.Write(e, SizeOf(e));
FS.Free;
result := True;
except
result := False;
end;
.
- Follow-Ups:
- Re: Writing Binary Files with TFileStream
- From: alanglloyd@xxxxxxx
- Re: Writing Binary Files with TFileStream
- From: Tom de Neef
- Re: Writing Binary Files with TFileStream
- From: Andreas Koch
- Re: Writing Binary Files with TFileStream
- References:
- Writing Binary Files with TFileStream
- From: Robert Kilroy
- Writing Binary Files with TFileStream
- Prev by Date: Writing Binary Files with TFileStream
- Next by Date: Re: pointer syntax
- Previous by thread: Writing Binary Files with TFileStream
- Next by thread: Re: Writing Binary Files with TFileStream
- Index(es):