Autor Beitrag
Biarchiv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: So 28.07.02 19:54 
Hallo,

Wie kann ich ja weiß
file1.seek(200, sofromcurrent) spring man ja eine Datei direkt dan.
Wie kann ich nun von einer Datei ab Stelle 300 bis stelle 600 in eine andere Datei hineinschreiben wo bei diese 300 Bytes überschrieben werden.
2te Datei ab Stelle 800.

Danke.
cbs
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 207
Erhaltene Danke: 1



BeitragVerfasst: So 28.07.02 20:10 
tag auch

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var fsFrom, fsTo: TFilestream;
begin
  fsFrom:= TFileStream.Create('c:\Datei1.txt', fmOpenRead);
  fsTo:= TFileStream.Create('C:\Datei2.txt', fmOpenWrite);
  fsFrom.Position:= 299; //position auf byte 300 setzen (da byte 1 = position 0);
  // fsTo.Position:= 799 // position in fsTo auf byte 800 setzen
  fsTo.CopyFrom(fsFrom, 300); //300 byte nach fsTo kopieren
  fsFrom.Free;
  fsTo.Free;
end;

fsTo.Position:= 799 habe ich ausgeklammert da ich nich genau weiß ob du es so meintest.

da fehlen sicher noch diese ganzen fehlerbehandlungsroutinen

ich hab den code auch net getestet und soll auch nur nen ansatz darstellen