Autor Beitrag
Fred Ferkel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 87



BeitragVerfasst: Fr 30.05.03 22:06 
hi

ich hörte mal das blockread/write sowie der dateizugriff über assignfile aus der mode sind und man mit streams arbeiten sollte

stimmt dies?

mfg sven
Hansi@OMG
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 304

Vista
Delphi 2006 Prof., Lazarus
BeitragVerfasst: Fr 30.05.03 22:10 
Meiner Meinung nach schon, denn mit Streams arbeitet es sich leichter und man hat auch mehr Funktionen. Und so weit ich die Erfahrung gemacht habe, unterstützen auch neuere Komponenten nur noch Streams.

_________________
Who doesn't know the Micrsoft developer "Mahatma Fatal Error"?
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Fr 30.05.03 22:29 
Im Endeffekt bleibt es Geschmackssache. Ich finde Streams logischer, vom Aufbau her, weil ich mich nie damit anfreunden konnte, daß wenn ich einen Record in eine Datei schreiben will, ich dann der Datei sagen muss, was es für ein Record sien soll.
Ein Manko haben aber die Streams: es gibt kein Truncate-Äquivalent, das lässt sich nur mit API erledigen.
Aber es stimmt schon, daß einige Sachen mit Streams eher realisierbar sind und daher diese bevorzugt werden. Zum Beispiel On-The-Fly-Komprimierung oder -Verschlüsselung (siehe zLib, das klappt auch nur mit Streams oder über einen Speicherpuffer).

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
worm
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 135


D6 Prof
BeitragVerfasst: Fr 30.05.03 22:59 
Was mich interessieren würde: Gibt es irgendwelche generellen Performance-Unterschiede zwischen Streams und pascal-files? Weiß da jemand was drüber?

_________________
In the beginning, the universe was created. This has made a lot of people very angry, and is generally considered to have been a bad move.
Hansi@OMG
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 304

Vista
Delphi 2006 Prof., Lazarus
BeitragVerfasst: Fr 30.05.03 23:37 
Ne leider weis ich nichts darüber. :cry:

_________________
Who doesn't know the Micrsoft developer "Mahatma Fatal Error"?
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: Sa 31.05.03 00:36 
Hi,
ich denke bei allen Programmen, die wir hier so proggen, sind die performance Unterschiede, die die Methoden haben, unerheblich ... oder?!

MfG BungeeBug
Fred Ferkel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 87



BeitragVerfasst: Sa 31.05.03 01:51 
das kommt doch nuun wirklich auf den umfang der datei-opretaionen an; wenn ich in der datei blos so ein paar einstellungen speichere dann ok aber wenn ich nen CRC algorithmus schreiben möchte dann ist die performance schon sehr viel wichtiger
worm
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 135


D6 Prof
BeitragVerfasst: Sa 31.05.03 14:55 
Bei mir wären Performance-Unterschiede schon wichtig, deshalb hab ich ja nachgefragt. Zum Einstellungen speichern wäre das wirklich uninteressant. Also hat irgendjemand Ahnung? Oder weiß jemand, wie Pascal Files intern realisiert sind im Vergleich zu Streams?

_________________
In the beginning, the universe was created. This has made a lot of people very angry, and is generally considered to have been a bad move.
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Sa 31.05.03 17:35 
ShadowCaster und ich hatten da mal eine längere Diskussion darüber, einfach mal im Forum ein bissche suchen...

@tommie-lie: wegen truncate:
Stream.Size := Stream.Position :roll: ;)

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Sa 31.05.03 18:16 
ha, und genau das geht mit FileStreams nicht. Sonst hätte ich mir nicht ein Bein ausgerenkt das rauszukriegen, als ich UltimaTag geschrieben habe und hätte nachher auch nicht wehmütig die API-Funktion benutzt, wegen der das Ganze nicht mehr unter Linux läuft...

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
w3seek
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 64

Win XP; Win 2k; Suse 9.0
D5 Std, D6 Personal
BeitragVerfasst: Sa 31.05.03 18:40 
tommie-lie hat folgendes geschrieben:
es gibt kein Truncate-Äquivalent, das lässt sich nur mit API erledigen.

einfacher geht es aber wenn du einfach das property Size des streams auf die gewuenschte Groesse setzt, dateien schneidet er dann auch ab ;)
ach ja, das funktioniert natuerlich nur dann wenn du die datei mit schreibrechten geoeffnet hast.
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Sa 31.05.03 18:56 
Delphi Online Help hat folgendes geschrieben:
Use Size to find the size of the stream. Size is used internally in routines that read and write to and from the stream. Setting the Size property of TStream does nothing. Some descendants of TStream override this property to allow applications to change the size of the resource accessed using the stream.

Und wenn du dir die Hierarchie vom TFileStream anschaust, wirst du sehen, daß TFileStream das Size-Property nicht überschreibt, also klappt es normalerweise nicht. Und bei mir hat es das auch nicht getan!

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
w3seek
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 64

Win XP; Win 2k; Suse 9.0
D5 Std, D6 Personal
BeitragVerfasst: Sa 31.05.03 19:32 
bei mir schon, erstell eine datei, schreib 20 buchstaben rein und mit folgenden code hat er bei mir die datei auf 10 bytes verkleinert:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var
  fs: TFileStream;
begin
  fs := TFileStream.Create('c:\datei.txt', fmOpenReadWrite or fmShareDenyWrite);
  fs.Size := 10;
  fs.Free;


Ich benutze Delphi 6 Personal

Moderiert von user profile icontommie-lie: Delphi-Tags hinzugefügt
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Sa 31.05.03 20:15 
:shock:
Ich fass es nicht, wieso hat das damals nicht geklappt?
GEIL, dann hab' ich mir die Mühe ganz umsonst gemacht!

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Sa 31.05.03 20:26 
Stimmt, TFileStream überschreibt die Methode SetSize nicht, aber THandleStream tut dies und TFileStream ist nunmal von THandleStream abgeleitet! ;) Außerdem.. wieso hast du dir ein ganzes Bein ausrenken müssen? SetEndOfFile ist doch recht einfach in der Handhabung... :roll: ;)

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Sa 31.05.03 20:42 
schon, aber ich habe zuerst versucht, irgendwelche Tipps und Tricks zu finden, das ganze ohne API hinzukriegen, also mit den Streams selber. Und da habe ich lange gesucht, nichts gefunden, und dann SetEndOfFile genommen.
Warum es damals nicht geklappt hat mit FileStream.Size ist und bleibt mir ein Rätsel...

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert