File Types

BlitzPlus Forums/BlitzPlus Beginners Area/File Types

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 could check the extention ?
file_in$ = Trim$(Lower$(file_in$))
if right$(file_in$, 4) = ".jpg" then print "This is a .jpg"

Else, you could read the file itself and look for the header: BMP starts with BM something, JPG starts with 2 bytes, then JFIF.
ff = ReadFile("c:\_xfiles\grass.bmp")

For i = 0 To 10
c = ReadByte(ff)
Print Chr$(c)
Next

CloseFile ff
WaitKey()
End