Next: Pipes, Previous: Single-key input, Up: Other I/O [Contents][Index]
For ways of storing character strings in memory see String representations.
Words for inputting one line from the keyboard:
accept ( c-addr +n1 – +n2 ) core
Get a string of up to n1 characters from the user input
device and store it at c-addr. n2 is the length of
the received string. The user indicates the end by pressing
RET. Gforth supports all the editing functions available
on the Forth command line (including history and word
completion) in accept.
edit-line ( c-addr n1 n2 – n3 ) gforth-0.6
edit the string with length n2 in the buffer c-addr
n1, like accept.
Obsolete words:
expect ( c-addr +n – ) gforth-obsolete
Receive a string of at most +n characters, and store it
in memory starting at c-addr. The string is
displayed. Input terminates when the <return> key is pressed or
+n characters have been received. The normal Gforth line
editing capabilites are available. The length of the string is
stored in span; it does not include the <return>
character. OBSOLETE: This word has been de-standardized in
Forth-2012. Use accept instead.
span ( – addr ) gforth-obsolete
The variable at addr contains
the length of the last string received by expect. OBSOLETE:
This word has been de-standardized in Forth-2012. Use
accept instead.
Next: Pipes, Previous: Single-key input, Up: Other I/O [Contents][Index]