12/28/2023 0 Comments Simply fortran window closesIf sta is DELETE, the file connected to the specified unit is deleted. The DISP= and DISPOSE= options are allowable alternates for STATUS=, with a warning, if the -ansi flag is set. The options can be specified in any order. The program control is transferred to this statement in case an error occurs while executing the CLOSE statement. I/O status specifier- ios must be an integer variable or an integer array element.Įrror specifier- s must be the label of an executable statement in the same program containing the CLOSE statement. For other files besides scratch files, the default sta is KEEP. For temporary (scratch) files, sta is forced to DELETE always. The default value for the status specifier is KEEP. If UNIT= is not used, then u must be first.ĭetermines the disposition of the file- sta is a character expression whose value, when trailing blanks are removed, can be KEEP or DELETE. Now I prefer to program in capitals, which is how I learnt Fortran 50 years ago, so why the format codes in lower case, and the captions with an initial capital? Because (a) the format codes could be in capitals, but lower case does make them stand out, and as for the captions, that’s pretty standard in Windows.The CLOSE statement disconnects a file from a unit. It will have the value 0 if the close box was clicked, and 1 for the button. So what does IA have to do with it? passes a code back to IA to say how the window was closed. But I could have added another directive OPTIONS (INTL, DREAL) to make the source code override any other setting. I’ve configured by version of FTN95 that way by default. I usually only make 32 bit apps, so I need 4-byte INTEGERs and 8-byte REALs. Now a further refinement is that you could make a 32 bit or 64 bit application. LGO incidentally could be /LGO, and simply means compile, link, and execute (‘GO’). Press either, and the window closes.Amazing! I didn’t actually need the Quit button, because the standard caption bar has an ‘X’ close button. Also, my Windows 10 theme doesn’t differentiate the colour of the caption bar. The black border is a bit I grabbed from the background, but if I moved this window to a white background I would see the shadow. So you run it from a command line – I use a text editor to create my Fortran cource codes which has a ‘DOS box’ or ‘Command window’ that is black. %ca sets up the caption bar, with in this case a title enclosed in square brackets, while %bt sets up a button, complete with its label, again in square brackets. You could have IMPLICIT NONE and declare IA to be INTEGER, if you wished.īut the clever stuff is in the INTEGER FUNCTION The first parameter (and the only one in this example) is a string, that contains 2-letter ‘format codes’, each prefixed with the symbol ‘%’. FTN95 will accept this or the free format style. If you prefer to use modules, you could, for example, use USE MSWIN instead.Īnd, you probably detected that I like Fortran 77 style, in which the variables have implicit type, and the card layout is used. INCLUDE is a way of getting all the routines and variables included in the program, many of which are quite unnecessary at this level, of course. The PROGRAM statement and the matching END – or END PROGRAM if you prefer) and standard Fortran things. So, what does every statement do? WINAPP is a directive that tells the program to produce a Windows executable. Here’s a simple Fortran code that creates a window with a caption, and a ‘Quit’ button. The point is Clearwin+, the easy to use interface to Windows, within which there is a great graphics system. Why? It doesn’t produce the fastest executables, but it compiles quickly, and has reasonable diagnostics. I’m a big fan of Silverfrost’s FTN95 Fortran compiler.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |