- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everybody,
I am converting a program from CVF 6.6 to IVF 11.1 and I am looking for an equivalent to this part of the code below :
1. What library should I call instead of MSFLIB ? Should I modify the functions used in the program FULLPATHQQ, ... ?
2. This program is used to open a data file named "inputData.txt", if this file does not exist in the correct directory, the line 15 (err=9001) call a window which allow to search fo a file manually (the same "open with" window that we have generally in all programs).
3. How can I change lines 15,16 ?
Thank you
- USE msflib
- CHARACTER($MAXPATH) pathin
- CHARACTER($MAXPATH) filein
- CHARACTER(2) drive
- CHARACTER($MAXPATH) dir,workdir
- CHARACTER($MAXPATH) namein
- CHARACTER(4) ext
- INTEGER*4 leng1,leng2,leng3
- LOGICAl(4) result
- ienter=1
- OPEN (ienter,FILE='inputData.txt',status='old',err=9001)
- call Function
- goto 1
- 9001 open(ienter,file='',status='old',err=9000)
- INQUIRE(ienter,name=filein)
- leng1=FULLPATHQQ(filein,pathin)
- IF(leng1.EQ.0)STOP
- IF(leng1.GT.0)THEN
- leng2=SPLITPATHQQ(pathin,drive,dir,namein,ext)
- IF(leng2.EQ.0)THEN
- WRITE(*,*) 'Can''t split path'
- STOP
- ENDIF
- ELSE
- WRITE(*,*)'Can''t get full path'
- STOP
- ENDIF
- RETURN
- 9000 WRITE(*,*) 'Reading error'
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
The module is IFPORT
USE IFPORT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re:2 you might want to use the /fpscomp:filesfromcmd option (set Fortran->Compatibility->Use Filenames from Command Line (Powerstation) = Yes in the VS IDE) to replicate the behaviour of Microsoft Fortran PowerStation, which would either use a command line argument or prompt for a filename if file='' in an open statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First of all, thank you.
I have tested by including the IFPORT, but I didn't succed in getting the 'open file window' (picture below).
I think the problem is due to my old WORKSPACE which I have changed (I have just picked up the code from the old project). In order to explain more, in the old project (CVF 6.6), thanks to the workspace settings (which I don't know how to set), the line number 15 {OPEN (ienter,FILE='inputData.txt',status='old',err=9001) } call the "Open file window".
I wish I was clear !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First - using IFPORT is the replacement for MSFLIB here in order to get the declaration of FULLPATHQQ.
To get the file selection dialog with this program, you need to build it as a QuickWin program, just as in CVF, and as noted need to set the "Files from command line" compatibility option. I suggest as an alternative look at the GetOpenFileName sample we provided - this will work in any program type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have requested this before but I feel compelled to repeat it: Why can't the file selection dialog work in any project type (whenever an "illegal" filename is used in the OPEN statement), and why can't it be the default and not require setting an obscure compatibility option?
I know it was argued that making such a change might break some existing programs, but that is hard to appreciate since the compiler response has always been to interrupt the program, request user input, and then continue. That's the sort of default response that would be expected in a DOS OS, but not in Windows.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For a non-QuickWin program, the behavior is to look on the command line used to run the program, NOT prompt the user, for the filename. That's the way it's supposed to work and if we changed it, it would break many applications. Use GetOpenFileName if you want the dialog all the time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Follow Steve's suggestion and look at the GetOpenFileName example found in the WIN32 zipped sample directory.
I suggest you change the code to a subroutine called (for example)
SUBROUTINE FINDMYFILE(FILEIN,STATUS,FLAGS)
with FILEIN supplied on input to the routine as the character buffer intended to hold the found full-path filename,
and modify the sample code to return the STATUS and the OFN%FLAGS VALUE as well as the full-path found filename in FILEIN.
A selected file should then be in FILEIN if the STATUS value is tested to be non-zero.
It is up to you whether you want to add bells and whistles such as changing the default search directory to that of the found file to save
time in subsequent searches.
It may be wise to add a call to COMMDLGEXTENDEDERROR() inside the routine if the status flag is non-zero so that you can then discover what went wrong.See the attached file COMDLGERR.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
dboggs wrote:
... but that is hard to appreciate since the compiler response has always been to interrupt the program, request user input, and then continue.
That is true for programs being run interactively. There are many programs that are run in batch mode (or under the control of scripts). For such programs there is no user standing by to provide user input. When a program attempts something improper or impossible, the program is aborted and a condition code is set. The script may retrieve the condition code and take appropriate action.
Changing the default action (for attempting to open a file with an invalid name) to waiting for user input would cause these batch programs and scripts to hang.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page