1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include <stdio.h>
#include <stdlib.h>
#include <term.h>
#include <term_io.h>
int main()
{
const int sz = 31;
char name[sz];
char passsword[sz];
struct term_screen ts; memset( &ts, 0, sizeof(ts) );
if ( term_init( &ts ) == -1 )
printf("Some err when init\n");
term_set_raw_mode( &ts );
term_clr_scr( &ts );
term_cur_set_c( &ts, 0);
term_cur_set_r( &ts, 1 );
term_readline( &ts, name, sz, READLINE_TEXT );
term_cur_set_c( &ts, 0 );
term_cur_set_r( &ts, 2 );
term_readline( &ts, passsword, sz, READLINE_HIDDEN );
term_clr_scr( &ts );
term_set_orig_mode( &ts );
printf("Name:%s\n", name);
printf("passsword:%s\n", passsword );
return 0;
}
|