Hello,
Problem solved. Just reopen the command...Now I'm occurring new problem.
while(1) {
printf("\nPlease make a selection,\n\n");
printf("AddList(L),AddElement(E),DeleteElement(R),\n");
printf("NumberOfElements(C),ShowList(P), Quit(Q): ");
scanf(" %c",&selection);
selection = toupper(selection);
switch(selection){
case 'L':
if(count <= 10){
queues[count] = queue_init();
count++;
printf(">>>New queue created.\n");
}
else
printf("You reach the maximum number of queues!\n");
break;
case 'E':
if(count>0){
printf("What you would like to add?\n");
fgets (input, MAX_STRING_LENGTH, stdin);
input[ strlen(input) - 1] = '\0';
queue_put ( queues[0], qitem_init(input));
}
else
printf("ERROR! You can't create an element without a queue.\n");
break;
case 'Q':
exit(0);
}
}
Here a part of my code. So is working correctly if pass 'L' but when passing 'E' and hit return(Enter) input initialise automatic to Null. If pass 'E (space) text' then initialise input = text;. How I can fix that? I mean when hit Enter passing 'E' to ask me ""What you would like to add?\n"" and the pass the text.
Thank you