ライブラリルーチン getarg(3F) を使用して、実行時にコマンド行引数を文字変数に読み込むことができます。引数はファイル名として解釈され、OPEN 文の FILE= 指定子で使用されます。
demo% cat testarg.f CHARACTER outfile*40 C ユニット 51 の出力ファイル名として最初の引数を取得する CALL getarg(1,outfile) OPEN(51,FILE=outfile) WRITE(51,*) 'Writing to file: ', outfile END demo% f95 -o tstarg testarg.f demo% tstarg AnyFileName demo% cat AnyFileName Writing to file: AnyFileName demo% |