Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - quit terminate program with clean up http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 quit                Terminate program with clean up
------------------------------------------------------------------------------
 Syntax
   quit [iExitCode]

 Arguments
   iExitCode is the exit code of the program passed to the calling process.

 Description
   The quit command closes all open files, terminates the program and
   returns to the calling process (i. e. DOS). This is the safest way to
   terminate a program. Any other method may result in loss of data or
   damage to open files.

   The quit command is implicitly executed when returning from the main()
   function. If quit is followed by the iExitCode argument, this value will
   be returned to DOS as the errorlevel.

 Example
   #define EXAMPLE_SYSTEM
   #include example.hdr

   proc Test_quit
   ? "Program start."
   if alert( "Quit program?", " Yes ; No ", RED_WHITE, BLUE_WHITE ) == 1
      ? "Cleaning up..."
      ? "Exiting program."
      quit 1 // return 1 to the calling process (DOS)
   endif
   ? "Continue executing program..."
   ? "Program end."
   quit 0 // without this call an accidental value is returned to DOS
   endproc

   proc main
   Test_quit()
   endproc

See Also: _quit

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson