accept
Summary
#include <dataman/dataman.h>
-or-
#include <dataman/sort.h>
accept(row,col,acc,mode) else ...
int row,col,mode;
char *acc;
Description
int acept(row, col, acc, mode)
The accept function does screen positioned, keystroke
polled input.
Row and col is the row and column number to begin
reading. Acc is a character pointer (string) to the
input buffer. The length of the string currently pointed
to by acc determines the maximum number of characters
that accept will read. Mode is a manifest constant
describing the type of input. The constant ANY will
accept any printable character, while the constant LOWER
will map all input to lower case. UPPER will map all
input to upper case, and NUMERIC will allow only numeric
input. Finally, the constant NOECHO may be or'd with any
of these to suppress the echoing of input to the screen.
If the system defined 'help' key is hit the input buffer
is set to zero length, the read is terminated, and the
else clause is taken. If a normal line terminator is
hit, acc is truncated to the number of input characters,
and the else clause is skipped. Function keys are
returned in the first byte as the scan code or'd with
0200.
Example
#include <dataman/dataman.h>
main(int argc, char *argv[])
{
int row,col; /* row and column */
char inpt[5]; /* input variable */
...
row = 5;
col = 15;
memset(inpt,' ',4); /* read 4 chars */
*(inpt+4) = '\0'; /* end string */
accept(row,col,inpt,UPPER) else {
flush()
return;
}
...
}
«previous next»