[Gambas-user] Terminal input without newline?

Bruce Steers bsteers4 at gmail.com
Mon Nov 20 17:40:22 CET 2023


Consider this code in a Terminal program...

  Dim sTxt As String
  Print "type something below.."
  sTxt = File.In.ReadLine()  ' read a line from stdin

  Print "the text typed was: " & sTxt

It prints "Type something below..." then in the line below i type text and
it is read to sTxt.

Now consider this code...

  Dim sTxt As String
  Print "type something here: ";
  sTxt = File.In.ReadLine()  ' read a line from stdin

  Print "the text typed was: " & sTxt

Trying to use ; at the end of Print so it does not use a linefeed but stays
on the same line does not work.
The text "Type something here: " does not show until after the user types
something and presses return.

Is there a way around that?
I tried Wait and a few other things but just cannot get the text to show
first unless it has a linefeed.

Thanks
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231120/aaf58fe9/attachment.htm>


More information about the User mailing list