Wrong action of Open command in Fortran( Insted read open command opens .txt file )2019 Community Moderator ElectionImporting data from file to arrayError: Two main PROGRAMs at (1) and (2)Missing explicit interface for subroutinefortran module use wrongReading from .txt file and writing to .txt fileFortran runtime error: End of fileReading a .txt file with fortran, on a MACNetCDF: Start+count exceeds dimension boundOpening and reading a file in Fortranreading in a file from fortran

NASA's RS-25 Engines shut down time

PTIJ: wiping amalek’s memory?

Filtering SOQL results with optional conditionals

Why is computing ridge regression with a Cholesky decomposition much quicker than using SVD?

Should I take out a loan for a friend to invest on my behalf?

Word for a person who has no opinion about whether god exists

meaning and function of 幸 in "则幸分我一杯羹"

How to secure an aircraft at a transient parking space?

Do items de-spawn in Diablo?

Can one live in the U.S. and not use a credit card?

Could you please stop shuffling the deck and play already?

What was the Kree's motivation in Captain Marvel?

Find longest word in a string: are any of these algorithms good?

How can The Temple of Elementary Evil reliably protect itself against kinetic bombardment?

Why was Goose renamed from Chewie for the Captain Marvel film?

Difference on montgomery curve equation between EFD and RFC7748

If I receive an SOS signal, what is the proper response?

What wound would be of little consequence to a biped but terrible for a quadruped?

An alternative proof of an application of Hahn-Banach

Is it "Vierergruppe" or "Viergruppe", or is there a distinction?

What's the "normal" opposite of flautando?

Makefile strange variable substitution

Are tamper resistant receptacles really safer?

Why does Captain Marvel assume the people on this planet know this?



Wrong action of Open command in Fortran( Insted read open command opens .txt file )



2019 Community Moderator ElectionImporting data from file to arrayError: Two main PROGRAMs at (1) and (2)Missing explicit interface for subroutinefortran module use wrongReading from .txt file and writing to .txt fileFortran runtime error: End of fileReading a .txt file with fortran, on a MACNetCDF: Start+count exceeds dimension boundOpening and reading a file in Fortranreading in a file from fortran










0















This is my simple code:



Program Example_Code

Implicit none

Integer :: iERR

Open( Unit = 15, File = 'Read_Something.txt', Action = 'Read', Status = 'Unknown', iostat = iERR )

If ( iERR /= 0 ) stop ( "There is no file Read_Something.txt !!!")


Close( 15, Status = 'Keep')

End Program Example_Code


In the project directory I did not create any .txt file( because I want to test opening file with iostat) and afther the program ends I find Read_Something.txtin the project folder.



What is wrong in this example?
Why does this obvious error occur?



IDE: Code::Blocks 17.12, TDM_GCC_5.0.1 - 03



OS: Win 10 X64










share|improve this question
























  • Use tag fortran for all Fortran questions.

    – Vladimir F
    Mar 6 at 15:34
















0















This is my simple code:



Program Example_Code

Implicit none

Integer :: iERR

Open( Unit = 15, File = 'Read_Something.txt', Action = 'Read', Status = 'Unknown', iostat = iERR )

If ( iERR /= 0 ) stop ( "There is no file Read_Something.txt !!!")


Close( 15, Status = 'Keep')

End Program Example_Code


In the project directory I did not create any .txt file( because I want to test opening file with iostat) and afther the program ends I find Read_Something.txtin the project folder.



What is wrong in this example?
Why does this obvious error occur?



IDE: Code::Blocks 17.12, TDM_GCC_5.0.1 - 03



OS: Win 10 X64










share|improve this question
























  • Use tag fortran for all Fortran questions.

    – Vladimir F
    Mar 6 at 15:34














0












0








0








This is my simple code:



Program Example_Code

Implicit none

Integer :: iERR

Open( Unit = 15, File = 'Read_Something.txt', Action = 'Read', Status = 'Unknown', iostat = iERR )

If ( iERR /= 0 ) stop ( "There is no file Read_Something.txt !!!")


Close( 15, Status = 'Keep')

End Program Example_Code


In the project directory I did not create any .txt file( because I want to test opening file with iostat) and afther the program ends I find Read_Something.txtin the project folder.



What is wrong in this example?
Why does this obvious error occur?



IDE: Code::Blocks 17.12, TDM_GCC_5.0.1 - 03



OS: Win 10 X64










share|improve this question
















This is my simple code:



Program Example_Code

Implicit none

Integer :: iERR

Open( Unit = 15, File = 'Read_Something.txt', Action = 'Read', Status = 'Unknown', iostat = iERR )

If ( iERR /= 0 ) stop ( "There is no file Read_Something.txt !!!")


Close( 15, Status = 'Keep')

End Program Example_Code


In the project directory I did not create any .txt file( because I want to test opening file with iostat) and afther the program ends I find Read_Something.txtin the project folder.



What is wrong in this example?
Why does this obvious error occur?



IDE: Code::Blocks 17.12, TDM_GCC_5.0.1 - 03



OS: Win 10 X64







fortran gfortran tdm-gcc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 6 at 15:34









Vladimir F

40.9k44072




40.9k44072










asked Mar 6 at 15:24









Enlil MaratovichEnlil Maratovich

226




226












  • Use tag fortran for all Fortran questions.

    – Vladimir F
    Mar 6 at 15:34


















  • Use tag fortran for all Fortran questions.

    – Vladimir F
    Mar 6 at 15:34

















Use tag fortran for all Fortran questions.

– Vladimir F
Mar 6 at 15:34






Use tag fortran for all Fortran questions.

– Vladimir F
Mar 6 at 15:34













1 Answer
1






active

oldest

votes


















4














You use status="unknown", that means the compiler can create the file for you so that you can read from it. If you want to open a file only when it exist, use status="old".



BTW, I find it quite useless to explicitly specify any ="unknown", just leave the argument out completely. But that is my personal style.






share|improve this answer























  • @francescalus, The Fortran standard states for ACTION= For a new file, the processor creates the file with a set of allowed actions that includes the specified action.

    – Steve
    Mar 6 at 22:36











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026559%2fwrong-action-of-open-command-in-fortran-insted-read-open-command-opens-txt-fil%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














You use status="unknown", that means the compiler can create the file for you so that you can read from it. If you want to open a file only when it exist, use status="old".



BTW, I find it quite useless to explicitly specify any ="unknown", just leave the argument out completely. But that is my personal style.






share|improve this answer























  • @francescalus, The Fortran standard states for ACTION= For a new file, the processor creates the file with a set of allowed actions that includes the specified action.

    – Steve
    Mar 6 at 22:36
















4














You use status="unknown", that means the compiler can create the file for you so that you can read from it. If you want to open a file only when it exist, use status="old".



BTW, I find it quite useless to explicitly specify any ="unknown", just leave the argument out completely. But that is my personal style.






share|improve this answer























  • @francescalus, The Fortran standard states for ACTION= For a new file, the processor creates the file with a set of allowed actions that includes the specified action.

    – Steve
    Mar 6 at 22:36














4












4








4







You use status="unknown", that means the compiler can create the file for you so that you can read from it. If you want to open a file only when it exist, use status="old".



BTW, I find it quite useless to explicitly specify any ="unknown", just leave the argument out completely. But that is my personal style.






share|improve this answer













You use status="unknown", that means the compiler can create the file for you so that you can read from it. If you want to open a file only when it exist, use status="old".



BTW, I find it quite useless to explicitly specify any ="unknown", just leave the argument out completely. But that is my personal style.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 6 at 15:36









Vladimir FVladimir F

40.9k44072




40.9k44072












  • @francescalus, The Fortran standard states for ACTION= For a new file, the processor creates the file with a set of allowed actions that includes the specified action.

    – Steve
    Mar 6 at 22:36


















  • @francescalus, The Fortran standard states for ACTION= For a new file, the processor creates the file with a set of allowed actions that includes the specified action.

    – Steve
    Mar 6 at 22:36

















@francescalus, The Fortran standard states for ACTION= For a new file, the processor creates the file with a set of allowed actions that includes the specified action.

– Steve
Mar 6 at 22:36






@francescalus, The Fortran standard states for ACTION= For a new file, the processor creates the file with a set of allowed actions that includes the specified action.

– Steve
Mar 6 at 22:36




















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026559%2fwrong-action-of-open-command-in-fortran-insted-read-open-command-opens-txt-fil%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко