I compiled a simple program in C (it does the sum of 2 numbers), by doing :
M-x compile RET
gcc -dummy.c -o dummy
M-x shell RET
./dummy
I get a prompt for the first number I can enter, then nothing is happening. I mean I can enter the first number, do RET, enter the second number (even though I don't have the prompt for this one) and I can get the result with Ctrl-D. So, very ugly. Any idea what is happening under the hood and what I should do to improve that? Thanks
here is the code :
int main()
{
int nb1,nb2;
printf("please enter nb1");
scanf("%d \n", &nb1);
printf("please enter nb2");
scanf("%d \n", &nb2);
printf("the sum:");
printf("%d + %d = %d", nb1, nb2, nb1 + nb2);
return 0;
}
shell-mode
is that it needs you to send and read full lines. So, when you doprintf()
it doesn't know the program finished printing. If you add\n
to yourprintf()
, I believe it will work inshell-mode
.