Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Debugging a console program

sumitm
Beginner
1,561 Views

Hi,

I have a console program that uses command line arguments like

app.exe  inp1.txt inp2.txt  out1.txt  out2.bmp

and I use 

call GETARG(3,fln1)  
call GETARG(4,fln2) 

to supply the filenames for the out1.txt and out2.bmp

For reading these input files I have 

 OPEN(UNIT = 101, FILE = ' ', STATUS = 'OLD', IOSTAT = IERR)

and the File =  ' ' takes in inp1.txt and a separate one for inp2.txt

  The issue is during debugging (using command arguments) it returns error in opening input file and I have to physically replace it with the filename
   OPEN(UNIT = 101, FILE = 'inp1.txt', STATUS = 'OLD', IOSTAT = IERR)

Why is this so. The compiled executable runs fine but during debugging I have to hardcode it in. The reason for the input file name to be different each time is this is run on a webinterface with multiple users possibly running the same application simultaneously and hence each user has a separate input and output filename

 

Thanks for any help

 

Sumit

0 Kudos
4 Replies
sabalan
New Contributor I
1,561 Views

What I remember from CVF, if I am not mistaken, is that the release version looks after the input file in the application folder (and all folders defined in the PATH variable) but the debug version looks into the upper folder (project folder) first.

0 Kudos
sumitm
Beginner
1,561 Views

Thanks!

However, I have specified the working directory as attached and it does write the output files correctly which are in the same directory

 

0 Kudos
Steven_L_Intel1
Employee
1,561 Views

You are relying on a nonstandard feature, which is disabled by default. To enable it, turn on Fortran > Compatibility > PowerStation > Files from Command Line. But why aren't you using the results of GETARG in your OPEN? Or use the standard GET_COMMAND_ARGUMENT.

0 Kudos
sumitm
Beginner
1,561 Views

 I converted the inputs to also GETARG commands and that works without having to put on Powerstation compatibility

Thanks

0 Kudos
Reply