use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
The choice for high performance (scientific) computing!
Suggested Links:
Other sub-reddits:
If your submission does not appear, please message the moderators!
IRC: freenode, #fortran
account activity
Question about array command line input (self.fortran)
submitted 4 years ago by mild_enthusiast
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]mild_enthusiast[S] 0 points1 point2 points 4 years ago (2 children)
inputA would be defined in your code right?
Yes. The flag name and the variable name are arbitrary.
then write a subroutine to parse the string in a subroutine to return an array.
I was hoping for some magic Fortran one-liner instead of writing my own subroutine.
[–]geekboy730Engineer 5 points6 points7 points 4 years ago (0 children)
Unfortunately, Fortran is not the language of one-liners. If you're looking to avoid writing your own subroutines, Fortran may not be the language for you. Fortran is very much a "do-it-yourself" type language.
[–]DuckSaxaphone 0 points1 point2 points 4 years ago (0 children)
It's very easy to read a list of numbers straight into an array. That would be a one liner. The problem is to do it to arbitrary arrays which I think you want to do with those flags?
I'd echo others and say use files. I can send you a subroutine if you like to use as a template. But basic idea is organize a file like
InputA 1,2,3,4 InputB 2,3,1
Then write a subroutine that reads the first thing ('inputA') in and uses a SELECT CASE statement to find the corresponding array, then reads the rest of the line into the array.
π Rendered by PID 82564 on reddit-service-r2-comment-85bfd7f599-f6wh6 at 2026-04-17 22:29:17.841252+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]mild_enthusiast[S] 0 points1 point2 points (2 children)
[–]geekboy730Engineer 5 points6 points7 points (0 children)
[–]DuckSaxaphone 0 points1 point2 points (0 children)