Reading a file help please

BlitzPlus Forums/BlitzPlus Programming/Reading a file help please

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You're trying to get the file type with a file handle. FileType accepts the path of a file, not a file handle (which you created with ReadFile).

Also, you're not closing the directory reading with CloseDir. And you don't need ReadFile unless you're going to read any data from the file (you will also need CloseFile if you do need to use ReadFile).

Function LoadApplicableData()
	Local Dir = ReadDir("Blitz")
	Local File$
	Repeat
	File$ = NextFile(Dir)
	If FileType(File$)=1 Then
		N.Node = New Node
		N\Txt$ = File$
		N\Dat = AddTreeViewNode(ProgNode,N\Txt$)
	EndIf
	Until File$=""
End Function

Try that. Not tested though.