Autor Beitrag
Terminator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34


D6 Prof
BeitragVerfasst: Do 08.09.05 08:49 
Hallo Zusammen,

ich möchte aus einer Textdatei alle Leerzeilen löschen.

Die TXT kann bis zu 4 GB groß sein also "LoadFromFile" geht nicht bräuchte zuviel Speicher. Am besten mit Streams oder so ?!?

Wie kann ich das realisieren ?

_________________
Man muss nicht alles glauben, was stimmt!
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Do 08.09.05 08:56 
Hallo!

Lese einfach zeilenweise ein (altmodisch über AssignFile/ReadLn oder per TStringStream) und schreibe dann zeilenweise in eine neue Datei, wobei du die Leerzeilen auslässt.

Das erfordert natürlich dementsprechenden Platz.

Cu,
Udontknow
Terminator Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34


D6 Prof
BeitragVerfasst: Do 08.09.05 09:47 
Ok, hab ich realisiert. Ist aber wie erwartet -> sehr langsam.
Gehts nicht schneller ?

_________________
Man muss nicht alles glauben, was stimmt!
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Do 08.09.05 12:52 
Schon mal MemoryMapped Files probiert?
Eventuell könnte es damit schneller gehen.
Terminator Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34


D6 Prof
BeitragVerfasst: Do 08.09.05 13:48 
user profile iconarj hat folgendes geschrieben:
Schon mal MemoryMapped Files probiert?
Eventuell könnte es damit schneller gehen.


Das sagt mir gar nichts hab auch nicht in der Hilfe gefunden ( D6 pro.).
Bitte um nähere Erläuterung

_________________
Man muss nicht alles glauben, was stimmt!
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Do 08.09.05 13:53 
versuchs mal mit nem TFilestream und TFilestream.Read

bzw mit AssignFile, Reset und BlockRead

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Do 08.09.05 14:01 
Bei Memory Mapped Files werden teile einer Datei direkt von der Festplatte in den Speicher gemappt, deswegen ist dieser Zugriff ziemlich schnell. Es gibt einige Api-Funktionen die die Erstellung von MMFs erledigen. Schau mal auf MSDN:msdn.microsoft.com/l...reatefilemapping.asp

Vielleicht hilft dir das weiter. Schneller als MMF geht es wirklich nicht.