using purebasic for a few months now, i finally got into the more difficult programming, so I started to study examples instead of copying the helpfile. a few days ago I found this piece of code on purearea and have been studying it for the last few evenings in a row.
beeing a rookie like me I did learn a lot from it, like how linkedlists work and stuff like that, but this particular piece of code doesn't get to me.
Code: Select all
;-Unpack
;Gepackte Datei aussuchen und wieder entpacken:
NewList DateienEntpacken.s() ;Liste zum Entpacken erstellen
Pfad$ = "C:\"
;Auswahlfenster für die gepackte Datei
PackDatei$ = OpenFileRequester("Dateien auswählen", Pfad$, "Gepackte Dateien (*.pac)|*.pac", 0)
If OpenPack(PackDatei$) ;Gepackte Datei öffnen.
*SpeicherAdresse = NextPackFile() ;Die erste Datei in eine Speicheadresse schreiben.
Groesse = PackFileSize() ;Die Groesse der Datei feststellen.
;Die Datei auslesen lassen, damit man die Namen der gepackten Dateien erhält und in die Liste schreiben.
For Schleife = 1 To Groesse
String$ = PeekS(*SpeicherAdresse, Groesse)
Position = FindString(String$, Chr(13), Schleife)
AddElement(DateienEntpacken())
Laenge = Position - Schleife
DateienEntpacken() = Mid(String$, Schleife, Laenge)
Schleife = Schleife + Laenge + 1
Next Schleife
Else
End
EndIf
e.g.
- what does the "*" mean (*GepackteDatei), think it has something to do whith the memory, but i'm not sure.
- What is happening in the part with the PeekS thing and all that stuff. (The helpfile tells me that i should stay out of there and, believe me, i would if it wasn't nescessary).
the orriginal piece of code at the codearchief is "Files_Pack&UnPack.pb", I also found another one that looked somewhat eazier but all of the comments were in frensh, really can't make sence out of that language, german is allready on the edge..., that one was named "PackUnpack_with-Filenames.pb" by the way...
well i hope i made my point clear here, thanks in advance,
your faithfull student, Bart
:roll: