fortran - how to connect a unit number to stdin and stdout? -


I have overwritten reserve unit number 5 and 6 for reading and writing files respectively. So I can not read stdin and can write stdout now.

Instead of changing all of my code, I want to add stdin and stdout to new unit numbers respectively 7 and 8, how can I do this?

Edit # 1

Let me cite an example to clarify my situation. Open (Unit = 5, file = 'input.txt', condition = 'old') Open (unit = 6, file = 'output.txt', position = 'REPLACE')

  ... some code ... Read (5, * format1 *) x, y, write z (6, * format2 *) i, j, k   

not original code by me It has been written and has about 4000 lines. Since I'm new in Foreign 77, I do not want to modify the statement of the code because I am worried that it will cause more problems to solve for me. It is possible to reconnect to a new unit number if it is possible to reconnect the stdin and stdout , so it will keep me away from many potential problems.

Edit # 2

Please read my question clearly. My question is how to do this, I am not in the matter that it is good to do this. If this is impossible to do, then it is also a valid answer for me and can prevent other people from repeating the same question. Thanks to all of you.

As you've searched for 5 and 6 Not reserved at all, these are the only units that are usually connected to the stdin and stdout on operating systems like Unix. I do not believe that there is a language-standard and portable way of adding other units to those pseudo-files. I also believe that by explaining the lack of faith I will remove them, who wants to know what you want to do. we will see.

In the meantime, if you are using the Intel Fortran compiler, then you can send the output sent in a file, or by setting the value of the environment variable by the file FOR_PRINT and FOR_READ . Check the compiler document for details.

Finally, I do not understand what you got in the situation where you should do, what you should do. Surely a global search and a good editor will replace the problem instead? More confusing to me, is that if you open the file on the units 5 and 6 then you can definitely modify some code statement ?

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -