- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
I'm working with a program which use Excel spreadsheet to take input data and write to an input file, then use a Fortran Console application to read that input file, perform some calculation and then write to several output files. The question is the location of the input file created by Excel may very. how could the Fortran Consonle application know where to find it. Is there anyway I could pass an argument or commnd line from Excel to Fortran exe.
コピーされたリンク
2 返答(返信)
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Sure, see NARGS/GETARG:
and change all your open statements so that they look like:
HTH
Jugoslav
PROGRAM Foo USE DFLIB CHARACTER (MAX_PATH):: sDir="" IF (NARGS() .GT. 0) CALL GETARG(1, sDir)
and change all your open statements so that they look like:
OPEN (11, FILE=TRIM(sDir)//"input.txt")
HTH
Jugoslav
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
You can also consider writing an Excel VBA macro to pass an argument directly to a Fortran DLL. You can probably change your console application to a DLL by changing its main program to a subroutine. If you do, though, the Fortran code shouldn't write any output to the console. The console won't exist unless the DLL explicitly creates it. Writing to and reading from files is OK.
Mike
Mike