Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- FILE *fp;
- char username[30];
- char password[30];
- char password2[30];
- void enterpw() {
- printf ("\nPassword: ");
- fgets (password, sizeof(password), stdin);
- printf ("Confirm password: ");
- fgets (password2, sizeof(password2), stdin);
- while (strcmp(password, password2)) {
- enterpw();
- }
- }
- int main() {
- printf ("\nPlease enter your username: ");
- fgets (username, sizeof(username), stdin);
- enterpw();
- fp = fopen ("user.dat", "a");
- fprintf (fp, "%s%s\n", username, password);
- fclose (fp);
- printf("\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement