To send input to a program's stdin running on the simulator, we can use piping: echo "some input" | pasim a.out.
Doing this on macos doesn't work. Example program:
#include <stdio.h>
int main() {
int x ;
scanf("%d", &x);
printf("Output: %d\n", x + 2);
return 0;
}
After compiling with patmos-clang -O2 main.c, and running using echo "2" | pasim a.out, we would expect it to output Output: 4, but instead we get Output: 2.
Clearly scanf is not working correctly.
Running the same program and commands on ubuntu outputs the expected string