Silverfrost Forums

Welcome to our forums

Fortran Code Help

18 Jun 2013 12:18 #12423

Ok a big sorry I am very new to Fortran, but have been coding in C for many years.

I have some very old code that I am looking at (complied in Ftn95/Plato IDE). The code now complies fine, but when executed the code crashes on trying to open a file. The executable is launched from a batch file, eg:-

Test.bat (contains)

c:\code\Test.exe C:\data\data.dat

the executable launches from the command line and requires to read in the data file. However the code opens the file like this:-

OPEN(5, '')

Currently unsure how this data file path is being retrieved and unsure why it is trying to open the file without a string being present.

I have replaced the OPEN command with

OPEN(5, 'C:\data\data.dat')

and all works fine, but I do need the ability to read the path from the batch file. Any pointer would be great 😄

Thanks for all your help 😄

18 Jun 2013 4:21 #12427

Try using the standard routine GET_COMMAND_ARGUMENT. You will find it in the FTN95 help file.

Please login to reply.