I am currently having two problems with my program for school. It's a database for usernames and passwords
1) I have to read from a file 2nd dimension of arrays (passwords) and change the password in the output file with numbers staying the same and letters A going to z B going y Z going to a etc. i know the offset is 32 and A starts with 65 but i cant think of how to write the code
2) Our professor wants the input of the password to be masked with "*" but their is a catch. It must compile in GCC so conio.h is out of the question. I tried to do the following but it just runs without inputting the mask.
Code:
void usernamepsw(){//scanning in user info
printf("Enter Username:");
for (k=0; (c = getchar()) != '\n'; ++k){//stores the user name as "user".
user[k] = c;
}
user[k] = '\0';
if (strcmp(user, "quit") == 0){
printf("Thank You for using the Database!\n");
fclose(fp);
fclose(fileout);
exit(0);
}
cbreak(); //To disable the buffering of typed characters and get a character-at-a-time input, you need to call this.
noecho(); //To suppress the automatic echoing of typed characters, you need to call this.
printw("\nEnter Password:");
for (k=0; (c = getch()) != '\n'; ++k)
printw("*"); //Print a '*' instead of the actual charater read.{//stores the password as "psw".
psw[k] = c;
}
psw[k] = '\0';
}
Also thats just the function, before the function was called in main i used
Code:
initscr(); //Before you use any other curses routines, the initscr() routine must be called first.
nocbreak(); //Normally we would read buffered input
echo(); //Normally we would like to have the echo of what we read on the screen
and at the end i used the terminating functions too