Problems reading a txt file..

Blitz3D Forums/Blitz3D Beginners Area/Problems reading a txt file..

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.

If your data file contains string variables (created with WriteString):
Function Readmoddata(file$)

If FileType(file$)=1
opened=ReadFile(file$)

Repeat
strng$=ReadString(opened)

If strng$="New list" WB3D_AddGadgetItem(catagory,strng$,0,0)

Until Eof(opened)

CloseFile opened
End If

End Function


If your data file is a true txt file (i.e. viewable in NotePad):
Function Readmoddata(file$)

If FileType(file$)=1
opened=ReadFile(file$)

Repeat
strng$=ReadLine$(opened)

If strng$="New list" WB3D_AddGadgetItem(catagory,strng$,0,0)

Until Eof(opened)

CloseFile opened
End If

End Function


Edit: just realized you were using CloseFile wrongly, too. :)