Ceci est une version archivée de
Cconrs() à 2006-02-16 01:07:46.
(
Char
CONsole
Read
String)
VOID Cconrs( str )
char *str;
Cconrs() reads a string from the standard input stream (
GEMDOS handle
0) and echoes it to the standard output stream (
GEMDOS handle
1). Special system keys like
Control-C are processed (see the full list below).
Opcode
10 (0x0A)
Availability
Parameters
str should be a character pointer large enough to hold the inputted string. On function entry, str[0] should be equal to the maximum number of characters to read.
Binding
pea str
move.w #$0A,-(sp)
trap #1
addq.l #6,sp
Return Value
On return, the string buffer passed as a parameter will be filled in with the inputted characters.
str[1] will contain the actual number of characters in the buffer.
(char *) &str[2] is the pointer to the start of the actual string in memory.
Cconrs() will not terminate unless
Control-C is pressed, the buffer is full or either
Return or
Control-J is pressed.
Caveats
GEMDOS versions below 0.15 echoes the input to the console even if output has been redirected elsewhere.
Comments
The string
Cconrs() creates is not null-terminated. The following keys
are processed by the function:
Key |
Translation |
Return |
End of input. Do not place RETURN in in buffer. |
Control-J |
End of line. Do not place Ctrl-J in buffer. |
Control-H |
Kill last character. |
Delete |
Kill last character. |
Control-U |
Echo input line and start over. |
Control-X |
Kill input line and start over. |
Control-R |
Echo input line and continue. |
Control-C |
Exit program. |
When the input stream is redirected,
Cconrs() returns
0 in
str[1] when the end-of-file marker is reached.
See Also