Thanks for reply.
I decided to use streams. I think they solved my problem.
Code:
type
tmy_header=record
f_type:array[0..3] of char;
codez:word;
end;
tmy_header2=record
typez:array[0..3] of char;
sizez:longword;
end;
mh: tmy_header
cht: tmy_header2;
fname: string; // filename
fstream: tfilestream;
procedure TForm1.Button1Click(Sender: TObject);
begin
fname:='c:\data.dat';
fstream:=tfilestream.Create(fname, fmCreate or fmOpenWrite or fmShareExclusive);
try
mh.f_type:='MHDR';
mh.codez:=100;
cht.typez:='RDHM';
cht.sizez:=255;
fstream.Write(mh,sizeof(mh));
fstream.Write(cht,sizeof(cht));
finally
fstream.Free;
end;
Now the data is correctly in my file, i will try to write more and look how it will work.I have original editor for this file, so i can test with this also, how it loads my file after i create it with my program. Until now it loads my created file OK.
If i have any problems with this, then i will let u know.
Thanks so far
Bookmarks