Autor Beitrag
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 01.08.04 19:37 
Hallo!

Ich möchte einen FileStream verkleinern (kürzen), weiß aber im Moment überhaupt nicht, wie ich das anstellen soll. Kann mir jemand helfen? :roll:

thx

Alstar
obbschtkuche
Gast
Erhaltene Danke: 1



BeitragVerfasst: So 01.08.04 21:17 
Vielleicht so?

ausblenden Delphi-Quelltext
1:
FileStream.Size := xyz;					
Alstar Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 01.08.04 21:23 
nein.

steht in der OH, dass es nicht funzt.

Alstar
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: So 01.08.04 21:30 
Hallo!

Bei TMemoryStream kannst du die Size einstellen. Wenn die Datei aber zu groß für einen Memorystream ist, musst du zunächst einen Lese-Filestream nehmen, und dann per CopyFrom die gewünschte Menge Bytes in den Zielstream schieben.

Cu,
Udontknow
Alstar Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 01.08.04 21:37 
Is das nicht n bissl viel bei einem Stream der gut und gerne 400 MB haben könnte?

Alstar
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: So 01.08.04 21:52 
Alstar hat folgendes geschrieben:
nein.

steht in der OH, dass es nicht funzt.

Wo steht das? Welche Delphi-Version? Bei mir funktioniert das (D6), hier überschreibt THandleStream (Vorfahr von TFileStream) die beiden SetSize-Methoden und setzt dann mit der API-Funktion SetEndOfFile die neue Dateigröße fest. Falls das bei dir nicht funktioniert kannst du ja aber selbst Gebrauch von dieser API-Funktion machen.. Einfach zur entsprechenden Position seeken und die Funktion mit dem File-Handle aufrufen...

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
Alstar Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 01.08.04 22:06 
mhhh. bei mir auch. momisch. in der OnlineHilfe von D7 Enterprise steht, dass bei der Änderung von "Size" des TFileStream nichts passieren würde!

Alstar
obbschtkuche
Gast
Erhaltene Danke: 1



BeitragVerfasst: So 01.08.04 22:36 
Vielleicht ein Übersetzungsfehler, wäre ja nicht der einzige (Ich hab kein D7, aber soweit ich weiß ist bei PosEx auch was falsch übersetzt :? )