Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ _cleanup(3C) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                             cleanup(3C)



        _________________________________________________________________
        cleanup                                                 function
        Flush the standard I/O buffers.
        _________________________________________________________________


        Calling Sequence

        void cleanup();
        cleanup();


        Description

        The _cleanup function does any cleanup needed by the C library
        before a program exits.  Typically, cleanup includes flushing the
        standard I/O buffers, and is done by either calling the exit
        function or by returning from the main function, which calls the
        exit function.  If you must replace the exit function, which is
        not recommended, be sure to call the _cleanup function before
        your program terminates.


        Returns

        The _cleanup function returns no value.


        Related Functions

        See also the exit function.


        Example

        This is an example of an exit function that needs to call the
        _cleanup function.
        /* Program test for the _cleanup() function */

        #include <stdio.h>

        void _cleanup(), exit();

        main() {
            printf("This program will terminate soon.\n");
            exit(0);
        }

        void exit(status)
        int status;
        {



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                             cleanup(3C)



            printf("Exit(%d) called.\n", status);
            _cleanup();
            _exit(status);
        }
        This program generates the output

        This program will terminate soon.
        Exit(0) called.














































        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026