Hi, I’m having an unusual issue and I’m leaning towards it being my system which is a Chromebook, running SmallBASIC in the Linux container with an arch64 processor. When I run the code instead of getting Hello World followed by a 1 second pause and another Hello World. I get a 5 second pause then Hello World spits out all at once like it’s been held in the print buffer.
thanks
#!/usr/bin/sbasic
for i = 1 to 5
print "Hello World ";
pause 1
next
stop
Hi BarrySWTP, thank you for reporting this bug. I’m using Linux and can reproduce this behavior when using the console version of SmallBASIC (sbasic). It seems, that because of the ; at the end of the print command, no screen update is performed. When removing the semicolon everything works as expected.
I checked the source code of SmallBASIC and realized, that the console version doesn’t do any screen refreshes. It is fully up to the terminal. Maybe I find a solution how to convince the terminal to update the screen.
Thanks J7M, I worked around it a few times using Run(echo - n blah blah) but it kept sitting in the back of my head bugging me, excuse the pun. I appreciate the effort of looking into it.
thanks
I fixed the bug: The default buffering mode in Linux for a terminal (console, CLI,…) is line buffered. An update of the screen is performed, once a line is finished and the cursor goes to the next line. An update of the screen can be triggered by force a flush. Now every time sbasic has printed a string fflush(stdout) is called.