END
Purpose: Immediately terminates a running program. END can be used multiple times in your program.
Syntax 1: END [= ErrorLevel%] Parameters:
|
For example, this program, getkey, returns the key pressed as an errorlevel
DIM ErrorLevel% DO ErrorLevel% = INKEY LOOP WHILE ErrorLevel% = 0 END = ErrorLevel%
In the batch file example below getkey is used to get a response based on an errorlevel from the hypothetical myprog program.
:begin myprog.exe if errorlevel = 0 goto done if errorlevel = 1 goto noinit if errorlevel = 2 goto baddata echo unknown error goto done :baddata echo Data was corrupt Use Backup Data Y/N getkey.exe if errorlevel = 89 goto olddata if errorlevel = 121 goto olddata if errorlevel = 78 goto done if errorlevel = 110 goto done goto baddata :olddata copy backup\myprog.dat myprog.dat goto begin :noinit echo No Initialization File. Use Backup File Y/N getkey.exe if errorlevel = 89 goto reinit if errorlevel = 121 goto reinit if errorlevel = 78 goto done if errorlevel = 110 goto done goto noinit :reinit copy backup\myprog.ini myprog.ini goto begin :done
Syntax 2:
END PROGRAM
|
Purpose: Intended for console mode programs, END PROGRAM forces the end of the main() function. This is particularly handy when you want to include blocks of "C" code outside of the main function. END PROGRAM must be used only once in your program.
Remarks:
An Example:
C_DECLARE SUB SayGoodNightGracy() PRINT "Hello, World!" SayGoodNightGracy() END PROGRAM ! extern void SayGoodNightGracy() ! ! printf("%s","Good Night Gracy!"); !