Problems with readdir and creating a list

BlitzMax Forums/BlitzMax Programming/Problems with readdir and creating a list

MacSven(Posted 2007) [#1]
I have some trouble with reading all files in a directory and storing the data into a TList. Here is my Code Sample;

' readdir.bmx

dir=ReadDir(CurrentDir())

If Not dir RuntimeError "failed to read current directory"

Global dirlist:TList=CreateList()

Repeat
t$=NextFile( dir )
If t="" Exit
If t="." Or t=".." Continue
Print t
ListAddLast dirlist,t$
Forever

For dirlist=EachIn list
Print dirlist
Next

CloseDir dir

has anyone a idea?


MacSven(Posted 2007) [#2]
OK. I have done. It work's now!


MrTAToad(Posted 2007) [#3]
I believe you need to use the list functions with types. That way, you can get values out of each item.