I cant explain why this is happening :
this program is supposed to be in an infinite loop.Code:while(1)
{
printf("what do you want to do \n");
printf("a> Send a file to the backend \n");
printf("b> Read a file in the backend \n");
printf("c> Execute a file in the backend \n");
scanf("%c",&choice);
printf("choice entered :%c\n",choice);
printf("enter the name of the file \n");
..
. ...
}
After the first loop is completed properly , the three options are displayed and the user is supposed to make his next choice.
But, my program is skipping through the scanf function in the second loop.
The first iteration is as expected,
this is what it shows after the first iteration :
Even before i type anything.Code:OUPUT:
a> Send a file to the backend
b> Read a file in the backend
c> Execute a file in the backend
choice entered :
enter the name of the file
in my code, I compare choice to select the option required, it doesnt get changed anywhere.
Why is this happening?