Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

FORTRAN

Name: Anonymous 2010-10-31 18:51

I am writing a short program in Fortran 95 as an excercise (and, please, I don't need to hear how Fortran is now obsolete -I have had no programming experience whatsoever up until quite recently and it was suggested to me as a good introduction). I have stumbled upon a problem which I am sure anyone more experienced than I am will be able to overcome.

I want the program to have a "command line": you enter some words, separated by blanks, and these are allocated to 5 character variables, len=10. The problem is, the READ*, command will force me to always input 5 values. I have programmed, for instance, the program to quit if one of the five variables is "EXIT". But, even if one of them is, I still have to input 5 words for the READ*, command to be executed, and then proceed to the next command. Is there a way that I can bypass this, so that I type "EXIT", press ENTER and then the READ*, function is executed, without changing lines? I've looked into FORMAT, and it doesn't seem to help (me, at least). Any help is greatly appreciated.

tl;dr: Fortran READ*, command which allocates 5 words to character variables is not executed until 5 words have been typed. How to program so that any number of words can be typed, then ENTER is pressed and the command is executed?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List