|
Post by rikky on Feb 11, 2023 11:38:10 GMT 1
I was looking for quickly doing some work which required some input. One of the inputs required multiple lines. Thus the NL$ needed to be included. I thought lets use the escape for this. OPTION INPUT CHR$(27)
PRINT PRINT "bla? "; INPUT A$
PRINT PRINT A$ PRINT It does nearly do the job. You type several sentences. Then an escape. Instead of breaking off, it prints the escape like ^[ And then you can continue typing until you press a newline. Then it breaks off. The result is however as it should be. Up until the escape character. Rik.
|
|
|
Post by Pjot on Feb 12, 2023 6:46:42 GMT 1
Hi Rick, Yes, this is how INPUT works. In older BaCon versions, it was implemented with the fgets C function. Currently, BaCon uses the getdelim C function standardized in 2008. The BaCon documentation is somewhat confusing in its description: "The OPTION INPUT parameter can be used to define where INPUT should cut off the incoming stream from STDIN." So this does not mean that the STDIN itself is cut off. It means that the stream that came in from STDIN is cut off. If you want to verify if a certain key is pressed, like the <ESC> key, then it might be better to use the WAIT function: PRINT PRINT "bla? "; PRINT
REPEAT key = WAIT(STDIN_FILENO, 50) IF key <> 0 AND key <> 27 THEN PRINT CHR$(key); UNTIL key = 27
PRINT "Done."
HTH Peter
|
|
|
Post by rikky on Feb 12, 2023 7:45:15 GMT 1
Ahzo. Well it was just to do some work once, so I did not want to make a whole program. And I thought to report, since you like bugs. Thanks for looking into this nonetheless. Rik.
|
|
|
Post by Pjot on Feb 12, 2023 14:05:35 GMT 1
And I thought to report, since you like bugs. I definitely do! So keep those bug reports coming Thanks, Peter
|
|