Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define O_WRONLY 01
- #define O_APPEND 02000
- int main(void)
- {
- // fd is an indentifier for the file that we are going to work with
- int fd;
- // We open the file with the write or append mode, so you will
- // have to create the file testfile.txt in the current directory.
- fd = open("jobby.txt", O_WRONLY|O_APPEND, 0);
- if(fd < 0)
- return 2;
- char str[10]= "";
- char buf1[] = "Please type username and hit Enter: ";
- write(1, buf1, sizeof(buf1));
- read (0, str, 10);
- write(fd,str, sizeof(str));
- char str1[10]= "";
- char buf2[] = "Please type in a password and hit Enter: ";
- write(1, buf2, sizeof(buf2));
- read (0, str1, 10);
- write(fd,str1, sizeof(str));
- char str2[10]= "";
- char buf4[] = "Please re-enter password and hit Enter: ";
- write(1, buf4, sizeof(buf4));
- read (0, str2, 10);
- write(fd,str2, sizeof(str));
- if(sizeof(str1)==sizeof(str2))
- {
- char buf5[] = "n password match: ";
- write(1, buf5, sizeof(buf5));
- }
- else
- {
- char buf6[] = "n password mismatch: ";
- write(1, buf6, sizeof(buf6));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement