Hi Everyone,
I am calling an Visual Fortran exe file from VC++ using ShellExecute and passing some parameters with it. I want my Fortran program to retrieve the parameter. I am using GetArg to retrieve it but it only works when i pass the parameter from the command-line and not using VC++
Herez the test code:
VC++ part of the code
Code:
#include <iostream>
#include <windows.h>
#include <shellapi.h>
int main(void)
{
ShellExecute(NULL,"open","C:\\Sassi\\MAIN\\HOUSEEx.exe","pb1","", SW_SHOW );
return 0;
}
Visual Fortran part of the code
Code:
CHARACTER MODNAME*50,FINP*120,FOUT*120,FILE4N*100
MODNAME = ''
IST=0
print*,'enter program HouseEX'
print*, 'ist=',ist
CALL GETARG (1, MODNAME)
IST = len(trim(MODNAME))
open(10,file='abcd.dat')
write(10,*) modname
write(10,*) ist
close(10)
IF (IST.LT.1) THEN
PRINT *,' ENTER INPUT FILE NAME '
READ (*,22) FINP
PRINT *,' ENTER OUTPUT FILE NAME '
READ (*,22) FOUT
PRINT *,' ENTER FILE4 NAME (INCLUDING FULL PATH)'
READ (*,22) FILE4N
Else
Print *,' Argument received '
ENDIF
22 FORMAT(A)
End
Any suggestion or help would be greatly appreciated.
---TaZ