diff options
Diffstat (limited to 'systems/msdos/tx/src/txprompt.c')
-rw-r--r-- | systems/msdos/tx/src/txprompt.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/systems/msdos/tx/src/txprompt.c b/systems/msdos/tx/src/txprompt.c new file mode 100644 index 0000000000..d68336f96f --- /dev/null +++ b/systems/msdos/tx/src/txprompt.c @@ -0,0 +1,27 @@ +#include <conio.h> +#include <stdlib.h> + +void UserPrompt(char *message, char *answer,int NumChars) +{ + /* Prompt user with message and put an answer of no more than NumChars */ + /* in the object pointed to by answer (an int or a char string) */ + + char *TextInLine, *buffer, *ptr ; + int row, col ; + + row = wherey() ; col = wherex() ; /* save cursor position */ + buffer = (char *) calloc(NumChars+2,sizeof(char)); + TextInLine = (char *) malloc(161); + gettext(1,25,80,25,TextInLine); + gotoxy(1,25) ; + clreol() ; /* clear last line */ + cputs(message) ; /* write prompt */ + *buffer = NumChars ; + ptr = cgets(buffer) ; + strcpy(answer,ptr) ; /* answer is a pointer to a string */ + puttext(1,25,80,25,TextInLine) ; /* restore last line */ + gotoxy(col,row) ; /* restore cursor position */ + free(buffer) ; + free(TextInLine) ; + return ; +} |