Command Prompt for Windows




The exit function exit() and Errorlevels

The standard library exit() may be used to exit a program at any time during it execution and the value past to it will set the errorlevel after the program exits. However, the following errorlevel values are reserved by the WinOne® Command Prompt and should not be used :-

  • 3 - Abnormal termination (ie. ^C pressed).
  • 255 - Incompatible External Command SDK version. The External Command is meant for a newer version of the WinOne® Command Prompt.

When a program exits it should return 0 to signal a normal termination and a value greater then 0 (ie. excluding 3 and 255) to signal an error :-

#include "woio.h"                                          
                                                                  
int main(void)
{                                                          
    printf("Hello, World\n");
    return 0;	/* normal termination */
}