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++ 3.0r4 - <b>_exit</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
_exit

Usage

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

Description

   _exit closes all output files and returns to the operating system with an
   exit status given by exitstatus. It does not call the static destructors
   or flush the buffers, but immediately returns to the operating system.
   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 <process.h>
   #include <stdio.h>
   #include <stdlib.h>

   int 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(EXIT_FAILURE);

           }
       }
   else
       {
           fprintf(stderr,"No file specified\n");
           _exit(EXIT_FAILURE);
       }
   }

See Also

   abort, exit, spawn



See Also: abort exit spawn

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