On 8 Sep 2011, at 11:48, Tquila wrote:
[…] if I run this:
int main(void){ int number; printf("Give number: "); scanf("%d", &number); printf("Number provided was %d", number); }
What happens is I get the said console output window, however it does not allow me to actually input stuff, it merely slaps 0 in the scanf.
Something like scanf reads from stdin. This only works (for interactive prompting) when running the program in a tty/pty (i.e. Terminal).
At one point we faked it by injecting code into everything being run from TextMate that would override open/read and prompt for reads on stdin. This caused (unfixable) problems starting with Snow Leopard when launching Preview and similar from TextMate (which is done e.g. when building LaTeX documents), so we removed the feature, but to get it back see this blog post: http://blog.macromates.com/2009/interactive-input/
We have a to-do about creating a pty environment for command executions, but this is a little down the list.