Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - _exit http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   _exit

   Usage
   #include <stdlib.h>
   void _exit(int exitstatus);

   Description
   _exit  closes all output files and returns to DOS with an exit  status
   given by exitstatus. It does not call the static destructors or  flush
   the  buffers, but immediately returns to DOS. exit is  preferred  over
   _exit for C++ programs.

   exitstatus  is  normally  EXIT_SUCCESS to indicate  a  normal  end  of
   program  and EXIT_FAILURE to indicate an error. Only the  lower  order
   byte of exitstatus is returned to the parent process. The exit  status
   can be referenced by the name ERRORLEVEL in batch files and the  spawn
   return values.

   Example
   #include <stdlib.h>
   #include <stdio.h>
   main(int argc,char *argv[])
   {
   FILE *fp;
        if(argc > 1)
        {
             fp = fopen(argv[1],"r");
             if(fp == NULL)
             {
                  fprintf(stderr,"Can't open file \"%s\"\n",argv[1]);
                  _exit(1);
             }
        }
        else
        {
             fprintf(stderr,"No file specified\n");
             _exit(EXIT_FAILURE);
        }
   }


See Also: abort exit spawn

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