int main(int argc, char const *argv[]) {
int id = access_queue();
char priority;
char message[100];
while (message != "") {
printf("Enter message:\n");
int result = scanf("%[^\n]s", message);
if (result == 0) {
write_value(id, "", '3');
break;
}
printf("Enter priority:\n");
priority = getchar();
scanf(" %c", &priority);
if (priority == '1' || priority == '2' || priority == '3')
write_value(id, message, priority);
else
printf("Priority must 1, 2 or 3 (1 being the highest)\n");
}
}
Okay, so I have this code which is supposed get the message from the terminal and then ask for the priority until the message is empty. The problem is that after asking for the priority and getting the value, it goes back to "Enter message" and without by input takes an empty string.