That's cool too. Someday I need to do a deep dive into all the stuff you can do with DATA and READ statements. Here's what I ultimately decided on. It's very similar to SMcNeill's. I decided to move the list count outside, so I can track my position in the array regardless of how many times I call this function or others. I made the extension string its own thing also just to keep my line widths down. Now I just need to test the thing and see if it works.

Code: (Select All)
Sub LoadFromTxt( txt_file$, names_list$(), list_count& )
''load a list of image file names from a txt file
Dim fp& : fp& = Freefile
Dim tmp$
Dim f_ext$
f_ext$ = ".png.bmp.jpg.tga.psd.gif.hdr.pic.pnm.pcx.svg.ico.cur.qoi"
Open txt_file$, For Input as fp&
While Not EOF(fp&)
Line Input fp&, tmp$
tmp$ = _Trim$(tmp$)
If tmp$ <> "" Then
''test for image suffix .*
If InStr(f_ext$, Right$(tmp$, 4)) Then
list_count& = list_count& + 1
names_list$(list_count&) = tmp$
Else
Print "Unknown file type " + tmp$
End If
End If
Wend
Close fp&
End Sub ''LoadFromTxt