SHUT3() and shut3c()

Fortran version:

    LOGICAL FUNCTION  SHUT3()

C version:

shut3c() is a C wrapper calling the Fortran SHUT3()

    int shut3c( ) ;

See Also:

M3EXIT(), which is a wrapper around SHUT3() that also writes a program-termination message and exits the calling program with caller-supplied status. M3ERR() is an obsolescent variant of M3EXIT() that doesn't understand the difference between program success and failure.

Summary:

SHUT3() and shut3c() flush to disk and close all Models-3 I/O API files currently open. Return .TRUE. or 1, respectively, on success, and .FALSE. or 0 on failure. Failure also generates log-messages attempting to describe the error. Calling INIT3() after SHUT3() may cause strange results on some systems. (Calls of INIT3() subsequent to SHUT3() will generate a warning message from INIT3() to the program log ).

Note that M3ERR() and M3EXIT() do a CALL SHUT3() prior to terminating a program.

Preconditions:

USE M3UTILIO or INCLUDE 'IODECL3.EXT' for Fortran, or
#include "iodecl3.h" for C.

I/O API must already be initialized by a call to INIT3().

Fortran Usage:

    ...
    USE M3UTILIO
    ...
    IF ( .NOT. SHUT3( ) ) THEN
C	    Unable to flush or close some file now open.  How to deal
C	    with it?? -- probably an unrecoverable-error situation.
    ...
    END IF
    STOP
    ...
    END

C Usage:

    ...
    #include "iodecl3.h"
    ...
    if ( ! shut3c( ) )
        {
            /*  unrecoverable-error situation ??  */
        ...
        exit( 2 ) ;
        }
    exit( 0 ) ;
    }


Previous: OPEN3

Next: WRITE3

Up: I/O API: Public Routines Up: Utility Routines

To: Models-3/EDSS I/O API: The Help Pages