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 <stdlib.h>
   void exit(int exitstatus);

   ANSI

Description

   exit calls functions logged by atexit, all static destructors (for C++
   programs), flushes all output buffers, closes all output files and
   returns to the operating system with an exit status given by exitstatus.
   exit is the preferred function for C++ programs.

   exitstatus is normally a 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 spawn return values.

Example 

   #include <stdlib.h>
   #include <stdio.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 \"%s\"\n"
           ,argv[1]);
               exit(EXIT_FAILURE);
               }
           }
       else
           {
               fprintf(stderr,"No file specified\n");
               exit(EXIT_FAILURE);
           }
       return (EXIT_SUCCESS);
   }


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