0

I have a hello world code that is compiled. How do I get the output of the executable in a file instead of printing in the terminal where the program runs. Can it be done without including "write" command in code ?

The executable created is "hello.out" and compiled using "mpif90 hello.f90 -o hello.out"

1
  • How do you write now? Probably you mean "without using an OPEN statement" Commented Oct 31, 2020 at 10:52

1 Answer 1

1
./hello.out > filename

If you still want to see the output on the terminal as well you can pipe it to tee instead:

./hello.out | tee filename

This will write the output to the file and to the terminal.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.