Would it be accepted practice to ReadString() a single byte and then process it? I used single-byte to test it first, but after adding a buffered version, I found that there is no variation in speed between the two. The performance is great, either way, so long as I don't display anything with PrintN(), otherwise it's very slow to display into the console. Is there a better practice I should use, or is this fine?
Code: Select all
FileSeek(0, 0)
While Not(Eof(0))
inpchr.s = ReadString(0, #PB_Ascii ,1) ; Read a single character
Select inpchr.s ; Process the single character
Case "#"
Do something
Default
Do something
EndSelect
Wend
Code: Select all
FileSeek(0, 0)
While Not(Eof(0))
inbuffer.s = ReadString(0, #PB_Ascii, 100) ; Read 100 character buffer
inbuflen.i = Len(inbuffer.s)
For inbufpos.i = 1 To inbuflen.i ; Go through each character in the buffer
inpchr.s = Mid(inbuffer.s, inbufpos.i ,1) ; Read a single character from the buffer
Select inpchr.s ; Process the single character
Case "#"
Do something
Default
Do something
EndSelect
Next inbufpos.i
Wend