Autor Beitrag
n-regen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 202
Erhaltene Danke: 2



BeitragVerfasst: Do 19.10.06 17:46 
Hallo!

Wie kann ich nach und nach lauter Bytes (also Integer zwischen 1 und 256) in einen Stream, bzw. eine Datei schreiben?
Ich habe mal was gehört, dass ich da Stream.Write brauche.
Stimmt das und wie sind die Parameter um z.B eine 1B-Datei zu erstellen, in der bloß z.B. 22 drinsteht?
Ich danke schon mal für die (hoffentlich) zahl- und hilfreichen Antworten.

Übrigens: Ich hab die Suche schon bemüht, der Topic mit den Zufallszahlen hilft mir nicht weiter.


Moderiert von user profile iconGausi: Topic aus Sonstiges (Delphi) verschoben am Do 19.10.2006 um 18:52
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 19.10.06 17:51 
Wenn du den Stream bereits erstellt hast, dann kann man einfach so da reinschreiben:
ausblenden Delphi-Quelltext
1:
aStream.Write(MyByteVar,sizeof(MyByteVar));					

_________________
We are, we were and will not be.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Do 19.10.06 17:51 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var stream: TFilestream;

stream := TFilestream.Create(pfad,fmCreate);
stream.write(deininteger,sizeof(deininteger));
FreeAndNil(stream);

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 19.10.06 17:53 
Das geht mit WriteBuffer, parameter sind dann die Variable und die Größe der Variable (herauszufinden mit SizeOf).
Wieder einlesen geht mit Read, Parameter sind die gleichen.

//EDIT: viel zu lahm :(

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.