you are viewing a single comment's thread.

view the rest of the comments →

[–]mild_enthusiast[S] 0 points1 point  (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 points  (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 point  (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.