Node:Input, Next:Pipes, Previous:Displaying characters and strings, Up:Other I/O
For ways of storing character strings in memory see String Formats.
Receive (but do not display) one character, char.
key-- char core ``key''
Determine whether a character is available. If a character is available, flag is true; the next call to
key?-- flag facility ``key-question''
keywill yield the character. Once
key?returns true, subsequent calls to
ekeywill also return true.
ekey-- u facility-ext ``e-key''
ekey?-- flag unknown ``ekey?''
ekey>charu -- u false | c true facility-ext ``e-key-to-char''
Attempt to convert the character string c-addr1 u1 to an unsigned number in the current number base. The double ud1 accumulates the result of the conversion to form ud2. Conversion continues, left-to-right, until the whole string is converted or a character that is not convertable in the current number base is encountered (including + or -). For each convertable character, ud1 is first multiplied by the value in
>numberud1 c-addr1 u1 -- ud2 c-addr2 u2 core ``to-number''
BASEand then incremented by the value represented by the character. c-addr2 is the location of the first unconverted character (past the end of the string if the whole string was converted). u2 is the number of unconverted characters in the string. Overflow is not detected.
Actual stack effect: ( c_addr u - r t | f ). Attempt to convert the character string c-addr u to internal floating-point representation. If the string represents a valid floating-point number r is placed on the floating-point stack and flag is true. Otherwise, flag is false. A string of blanks is a special case and represents the floating-point number 0.
>floatc-addr u -- flag float ``to-float''
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
acceptc-addr +n1 -- +n2 core ``accept''
edit the string with length n2 in the buffer c-addr n1, like
edit-linec-addr n1 n2 -- n3 gforth ``edit-line''
c-addr is the address of a transient region that can be used as temporary data storage. At least 84 characters of space is available.
pad-- c-addr core-ext ``pad''
OBSOLESCENT: superseded by
convertud1 c-addr1 -- ud2 c-addr2 core-ext ``convert''
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
expectc-addr +n -- core-ext ``expect''
span; it does not include the <return> character. OBSOLESCENT: superceeded by
span-- c-addr core-ext ``span''
Variable- c-addr is the address of a cell that stores the length of the last string received by