-
Notifications
You must be signed in to change notification settings - Fork 0
/
manager.c
68 lines (53 loc) · 1.24 KB
/
manager.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <stdio.h>
#include <stdio.h>
#include <unistd.h>// for fork
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
/**********Structure**********/
struct User{
char employeeName[50];
char jobTitle[50];
char status[50];
};
/**********UserInput**********/
int structure(){
struct User *userPtr, user;
userPtr = &user;
char option = 'y';
char ch;
char *arr;
int fd;
// FIFO file path
char * myfifo = "myfifo.txt";
// Creating file FIFO
mkfifo(myfifo, 0644);
if (option == 'y'){
do{
printf("Enter Employee Name: ");
scanf("%s", userPtr->employeeName);
printf("Enter Job Title: ");
scanf("%s", userPtr->jobTitle);
printf("Enter Status: ");
scanf("%s", userPtr->status);
arr = userPtr->employeeName;
write(fd, arr, strlen(arr)+1);
printf("Do you want to continue? y/n: ");
scanf("%s", &ch);
}
while(ch == 'y');
}
fd = open(myfifo, O_WRONLY);
close(fd);
//fd = open(myfifo, O_RDONLY);
//read(fd, arr1, sizeof(arr1) != strlen(arr1));
//printf("User2: %s\n", arr1);
//close(fd);
return 0;
}
void manager() {
printf("Hello from the mananger thread.\n");
//structure();
}