Terminality
Terminality copied to clipboard
Terminality does not handle "scanf" inputs correctly in C
printf works:
#include <stdio.h>
int main() {
printf("Insert an integer: ");
}
printf + scanf doesn't work so well and printf only appears after an input:
#include <stdio.h>
int main() {
int n;
printf("Insert an integer: ");
scanf("%d", &n);
}
but the inputs before the print are added to the calculation:
#include <stdio.h>
int main() {
int n;
printf("Insert an integer: ");
scanf("%d", &n);
printf("n + 3 = %d", n + 3);
}
Outside of terminality, it works perfectly fine in CMD and Git Bash. Terminality has no problems running Python.
Currently running Windows 10 x64 with Sublime 3083.
The problem is Terminality shell is not a terminal emulator which cause the output to be buffered which is why you have to enter all inputs before it printing out the result.
To solve this issue, you might want to flush the output after printing so Terminality can pick up the output from the buffer.
I will mark this issue as enhancement
instead of bug
since I also want the Terminality to print out the output without flush the buffer.
Oh, so that's how it works. Many thanks and sincere appreciation and sorry for the trouble!
No problem! Issue like this always help improve quality of the plugin :)
but if i use cin cout it can output without bufferring