putting comments in text file

Blitz3D Forums/Blitz3D Beginners Area/putting comments in text 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.

Function Read_Line$(File)
	; Read a line from the given file
	LineFromFile$ = ReadLine$(File)

	; Keep reading lines until there's a line found that doesn't start with a semicolon
	While Left$(LineFromFile$, 1) <> ";"
		; Make sure the end of the file hasn't been reached yet
		If Not Eof(File)
			; Read a new line
			LineFromFile$ = ReadLine$(File)
		EndIf
	Wend

	; Return the first line without a semicolon
	Return LineFromFile$
End Function


This function reads all kind of data.
When the function returns something, it is always a string.
Just do this:

FloatVar# = Read_Line$(file)


And Blitz converts it automatically into a float, if the line contained a float value.