HIII
i look for a way to write a function that hide the characters and replaces them by "*"
also using the secure text input to avoid buffer problem
So I wrote the code for the secure text input
here is the code :
any suggestion ?Code:#include <stdio.h>#include <stdlib.h> #include <string.h> void empty_buffer() { int c = 0; while (c != '\n' && c != EOF) { c = getchar(); } } int readpsw(char *chaine,int length) { char *carac; if(fgets(chaine,length,stdin)!=NULL) { carac=strchr(chaine,'/n'); if(carac!= NULL) { *carac='/0'; }else { empty_buffer(); } } else { empty_buffer(); } } int main ( int argc, char** argv ) { char psw[100]; printf("enter a password :"); readpsw(psw,21); return 0; }