Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macos: pipe input doesn't work with scanf #21

Open
Emoun opened this issue Nov 10, 2022 · 2 comments
Open

macos: pipe input doesn't work with scanf #21

Emoun opened this issue Nov 10, 2022 · 2 comments

Comments

@Emoun
Copy link
Member

Emoun commented Nov 10, 2022

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

@Emoun
Copy link
Member Author

Emoun commented Nov 10, 2022

Could this be related to t-crest/patmos#85 ?

@schoeberl
Copy link
Member

Wow, that difference between macos and Linux? The above-mentioned issue is reported on patemu instead of pasim. But maybe they are related. And in newlib instead of the two simulators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants