You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I compiled it using the commandclang -target riscv64-linux-gnu -static test.c and executed the spike /riscv64-linux-gnu/bin/pk a.out command. Then, I manually entered 100, and it outputted the correct result 100, just like this:
But when I used another command spike /riscv64-linux-gnu/bin/pk a.out < input.txt(the content of input.txt is 100), it didn't output the expected 100 but instead 0, just like this:
Thanks for your reply.
I'm sorry that my question misled you. I don't want to change my test program, in other words, I don't want to use fopen. How can I pass the contents of a file to my program? Is it possible to achieve this by modifying the shell command(spike /riscv64-linux-gnu/bin/pk a.out < input.txt)?
I have written a test program as follows:
I compiled it using the command
clang -target riscv64-linux-gnu -static test.c
and executed thespike /riscv64-linux-gnu/bin/pk a.out
command. Then, I manually entered 100, and it outputted the correct result 100, just like this:But when I used another command
spike /riscv64-linux-gnu/bin/pk a.out < input.txt
(the content of input.txt is 100), it didn't output the expected 100 but instead 0, just like this:Is there an error in my usage? What should I do?
The text was updated successfully, but these errors were encountered: