On the fly in eine Datei schreiben

Kosh

Erfahrenes Mitglied
Ich hab nun eine Funktion die bewirkt das er bestimmte Dateien in einen von mir angegebenen Verzeichniss sucht und möchte aber das er die Ergebnisse gleichzeitig in eine Datei schreibt. Aber anstatt der ergebniss schreibt er "" mehr nicht.
Könnte mir da jemand weiterhelfen

Code:
Private Function DirDiver(NewPath As String, DirCount As Integer, BackUp As String) As Integer
' Recursively search directories from NewPath down...
' NewPath is searched on this recursion.
' BackUp is origin of this recursion.
' DirCount is number of subdirectories in this directory.
Title = "Save"

Static FirstErr As Integer
Dim DirsToPeek As Integer, AbandonSearch As Integer, ind As Integer
Dim OldPath As String, ThePath As String, entry As String
Dim SearchFlag As Boolean
Dim retval As Integer
SearchFlag = True ' Set flag so the user can interrupt.
DirDiver = False ' Set to True if there is an error.
retval = DoEvents() ' Check for events (for instance, if the user chooses Cancel).
If SearchFlag = False Then
DirDiver = True
Exit Function
End If
On Local Error GoTo DirDriverHandler
DirsToPeek = Dir1.ListCount ' How many directories below this?
Do While DirsToPeek > 0 And SearchFlag = True
OldPath = Dir1.Path ' Save old path for next recursion.
Dir1.Path = NewPath
If Dir1.ListCount > 0 Then
' Get to the node bottom.
Dir1.Path = Dir1.List(DirsToPeek - 1)
AbandonSearch = DirDiver((Dir1.Path), DirCount%, OldPath)
End If
' Go up one level in directories.
DirsToPeek = DirsToPeek - 1
If AbandonSearch = True Then Exit Function
Loop
' Call function to enumerate files.
If File1.ListCount Then
If Len(Dir1.Path) <= 3 Then ' Check for 2 bytes/character
ThePath = Dir1.Path ' If at root level, leave as is...
Else
ThePath = Dir1.Path + "\" ' Otherwise put "\" before the filename.
End If
For ind = 0 To File1.ListCount - 1 ' Add conforming files in this directory to the list box.

DoEvents
If Len(File1.List(ind)) >= Val(txtzeichenlaenge.Text) Then Txtergebnisse.Text = Txtergebnisse.Text & ThePath & File1.List(ind) & Chr$(13) & Chr$(10)
DoEvents


Next ind
' mp3Path2Combo.AddItem (ThePath)
End If
If BackUp <> "" Then ' If there is a superior directory, move it.
Dir1.Path = BackUp
End If
Exit Function
DirDriverHandler:
If Err = 7 Then ' If Out of Memory error occurs, assume the list box just got full.
DirDiver = True ' Create Msg and set return value AbandonSearch.
MsgBox "You've filled the list box. Abandoning search..."
Exit Function ' Note that the exit procedure resets Err to 0.
Else ' Otherwise display error message and quit.
MsgBox Error
End
End If
End Function
 
OKAY Lösung ist gefunden, aber neues Problem, der schreibt nicht alles in die Datei, bei 64kb ist Schluss kann man das umgehen?
 
Hi alle zusammen,
also er hat recht, wo machst du da eine Datei auf um was hineinzuschreiben? Die Begrenzung wäre nur wenn du die Dateien erstmal in eine Textfeld (32kb) lädst und sie dann in eine separate Datei schreibst, was natürlich blödsinn wäre. Ich würde die empfehlen entweder on the fly oder in ein Array.

Erklärung:
----------

On the fly:

-Du liest die Datei
-Schreibst sie zur gleichen Zeit in eine andere Datei

Array:

-Du liest die Datei
-Schreibst die Datei in ein Array (Unbegrenzt)
-Schreibst den Array in eine andere Datei

Wenn noch fragen seien sollten, einfach schreiben *g*

gruß xtrem
 
Zurück