Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. define O_WRONLY 01
  2. #define O_APPEND 02000
  3.  
  4. int main(void)
  5. {
  6. // fd is an indentifier for the file that we are going to work with
  7. int fd;
  8. // We open the file with the write or append mode, so you will
  9. // have to create the file testfile.txt in the current directory.
  10. fd = open("jobby.txt", O_WRONLY|O_APPEND, 0);
  11.  
  12.  
  13. if(fd < 0)
  14. return 2;
  15. char str[10]= "";
  16. char buf1[] = "Please type username and hit Enter: ";
  17. write(1, buf1, sizeof(buf1));
  18. read (0, str, 10);
  19. write(fd,str, sizeof(str));
  20.  
  21. char str1[10]= "";
  22. char buf2[] = "Please type in a password and hit Enter: ";
  23. write(1, buf2, sizeof(buf2));
  24. read (0, str1, 10);
  25. write(fd,str1, sizeof(str));
  26.  
  27. char str2[10]= "";
  28. char buf4[] = "Please re-enter password and hit Enter: ";
  29. write(1, buf4, sizeof(buf4));
  30. read (0, str2, 10);
  31. write(fd,str2, sizeof(str));
  32.  
  33. if(sizeof(str1)==sizeof(str2))
  34. {
  35. char buf5[] = "n password match: ";
  36. write(1, buf5, sizeof(buf5));
  37. }
  38. else
  39. {
  40. char buf6[] = "n password mismatch: ";
  41. write(1, buf6, sizeof(buf6));
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement