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 - setbreakkey() define a break key http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 setbreakkey()       Define a break key
------------------------------------------------------------------------------
 Declaration
   io.hdr

 Syntax
   func uint setbreakkey extern
   param value uint uCode

 Arguments
   uCode is the key code to define as the break key.

 Return
   The previous break key.

 Description
   The setbreakkey() function allows defining a break key for the
   application.

   After a keyboard entry, Force compares the code of the entered key against
   the contents of an internal flag. If these are equal, the program
   terminates by executing an internal quit (which closes all open files and
   calls a possibly defined fexit() procedure).

   By default, the flag contains 0, i.e. the program cannot be interrupted
   by a special key stroke.

   Key entries will only be checked when an application waits for
   keystrokes, but not while other wait states are current, e. g. while
   indexing or packing a database.

 Example
   #define EXAMPLE_IO
   #include example.hdr

   #define DEBUG
   
   proc Test_setbreakkey
   // in debug mode, allow the Esc key to terminate the program
   #ifdef DEBUG
      setbreakkey( K_ESC )
   #endif
   ? "Press a key. Escape prevents further execution."
   getkey()                        // accept a key press
   ? "Escape was not pressed"      // only executed if Esc was not pressed
   endproc

   proc main
   Test_setbreakkey()
   endproc

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