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

Trying to open a folder defined by user input to select a file

pr_777
Novice
914 Views

In reference to post: 

Getting error code 29 on open with executable

Using IFQWIN, this statement works as expected - opens a windows explorer and allows user to (1)select a file:  Open(11,FILE=' ',READONLY,STATUS='OLD',ERR=1004,IOSTAT=Iodum)

If I want to allow the user to input a path for the directory (variable wfolder), I did the following (2)statement:  Open(11,FILE=wfolder//' ',READONLY,STATUS='OLD',ERR=1004,IOSTAT=Iodum)

However, when building the solution in Visual Studio 2019, it gives me the following error:

error #5082:Syntax error, found END-OF-STATEMENT when expecting one of :),

This setting in VS Studio 2019 works where I get no error 29 [with (1) above] when compiling from solution in above stated post:

Compatibility > Use Filenames from Command Line

 (

/fpscomp:filesfromcmd

)

Thanks for the assistance.

 

 

0 Kudos
4 Replies
Steve_Lionel
Honored Contributor III
879 Views

You can’t do it this way, though I’m guessing the actual code you have isn’t the same as what you posted given the syntax error. See if the OPEN keyword DEFAULTFILE does what you want. The prompt feature works only when the FILE= value is completely blank.

0 Kudos
pr_777
Novice
851 Views

Thanks, the original code is number (1) in my original post.  It opens a window explorer in the current working directory and allows the user to select any file.  I want to change this to allow the user to input a directory path and select any file in that path.

I tried the following:

character wfolder

wfolder = ' '

Open(11,DEFAULTFILE=wfolder,READONLY,STATUS='OLD',ERR=1004,IOSTAT=Iodum)

This gives me syntax error #5082 and error #6318

also tried:

character wfolder

wfolder = ' '

Open(11,FILE=' ',DEFAULTFILE=wfolder,READONLY,STATUS='OLD',ERR=1004,IOSTAT=Iodum)

This gives me syntax error #5082 and error #6323

 

0 Kudos
JohnNichols
Valued Contributor III
845 Views
character wfolder

wfolder = ' '

Open(11,DEFAULTFILE=wfolder,READONLY,STATUS='OLD',ERR=1004,IOSTAT=Iodum)

character wfolder

wfolder = ' '

Open(11,FILE=' ',DEFAULTFILE=wfolder,READONLY,STATUS='OLD',ERR=1004,IOSTAT=Iodum)
pr_777
Novice
750 Views

This solution does not work for lines (7 - 11).  Thank you.

0 Kudos
Reply