Page 1 of 1
Just a little help with file reading...
Posted: Thu Oct 13, 2011 11:42 am
by FragSax
I'm working on the simplest possible scripting language and all I really want to know is how I could implement comments? In my head comments start with a '#' and I just want PureBasic's File function to ignore that line... How would I go about doing something like this?
Re: Just a little help with file reading...
Posted: Thu Oct 13, 2011 11:56 am
by Ramihyn_
Line by line parsing of an open text file. Skip execution of empty lines and lines starting with a '#'
Code: Select all
While (Eof(fileID) = 0)
Command$ = Trim(ReadString(FileID))
First$ = Left(Command$, 1)
If ((First$ <> "") And (First$ <> "#"))
endif
Wend
As long as you dont support multiple commands each line.
Re: Just a little help with file reading...
Posted: Fri Oct 14, 2011 5:44 am
by FragSax
Very much appreciated...