help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: automatic execution of user functions when exit octave


From: Stefan Mahr
Subject: Re: automatic execution of user functions when exit octave
Date: Fri, 26 May 2006 18:11:52 +0200
User-agent: Thunderbird 1.5 (Windows/20051025)

Thanks, but I need it within a C++ function. But the following solution seems to work:


extern std::stack<std::string> octave_atexit_functions;

...

std::string arg = "somefunction");
octave_atexit_functions.push(arg);


Any comments? Is there a other solution? Maybe it is a good idea to put the octave_atexit_functions definition directly to toplev.h


Keith Goodman:
On 5/26/06, Stefan Mahr <address@hidden> wrote:
is it possible to "plug in" a user function to the exit routine?

Put atexit("myfunc") in your ~/.octaverc file. Or in the system-wide octaverc.

help atexit
atexit is a built-in function

 -- Built-in Function:  atexit (FCN)
    Register a function to be called when Octave exits.  For example,

         function print_fortune ()
           printf ("\n%s\n", system ("fortune"));
           fflush (stdout);
         endfunction
         atexit ("print_fortune");

    will print a message when Octave exits.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]