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

Open file problem

royxu
Beginner
654 Views
Dear all,
I am designing a dialog by using Visual Fortran. I have one button in my dialogwhich is designed to open parameter file. When I click that button,
a open file windown is opened(like we click the open icon in any software and give us the directory and file to choose) and I can choose thefile.
After I choose the file, the program will load these parameters in that file into that dialog.
But the problem is if I am not going to choose any file, a message box pops out ("A File must be selected, Terminate Program, Yes, No"). If I click the Yes, it will stop my program. If I click No, go back to open file window.
I still need to run my program, so I don't want to stop my program, and I also don't want to go back to open file again. I am thinking whether there is a way you can get out from selecting file andback to thedialog?.
Iam usingfollowing statement to open a file
open(36,file=' ',status='old',err=99)
Thanks!
Roy

Message Edited by royxu on 04-26-2005 06:35 AM

Message Edited by royxu on 04-26-2005 06:39 AM

0 Kudos
4 Replies
Steven_L_Intel1
Employee
654 Views
You are using the old Microsoft PowerStation way of prompting for a file, and it does not have the flexibility you want. I suggest instead that you use the GetOpenFilename Win32 API routine. An example demonstrating this is provided in the CVF samples under the name GETOPENFILENAME. If you can't find this, let me know.
0 Kudos
royxu
Beginner
654 Views
Ididn't find sample codeyou mentioned early. Could you please send it to me?
0 Kudos
Steven_L_Intel1
Employee
654 Views
Here it is.
0 Kudos
royxu
Beginner
654 Views
Thank you so much! I got it.
Roy
0 Kudos
Reply