Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. //Lashchev, Yan
  2. //CS50(3597)
  3. //Assignment 11
  4. //Files.c
  5.  
  6.  
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9.  
  10. int main(void)
  11. {
  12. FILE *fpName, *fpPass;
  13.  
  14. char *isName, *isPass;
  15. char user[100], pass[100];
  16. fpName = fopen("usernames.txt","r");
  17. fpPass = fopen("passwords.txt","r");
  18.  
  19. if (fpName==NULL || fpPass==NULL)
  20. {
  21. printf("Username or Password File Cannot Found\n");
  22. exit(0);
  23. } else do {
  24. while ((isName = fgets(user, 100, fpName)) != NULL &&
  25. user[0] == '\n')
  26. continue;
  27. while ((isPass = fgets(pass, 100, fpPass)) != NULL &&
  28. pass[0] == '\n')
  29. continue;
  30. if (isName && isPass) {
  31. printf("Username: %s", user);
  32. printf("Password: %s\n", pass);
  33. }
  34. } while (isName && isPass);
  35.  
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement