Chapter Contents

Previous

Next
abort

abort



Abnormally Terminate Execution

Portability: ISO/ANSI C conforming, UNIX compatible, POSIX.1 conforming


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
IMPLEMENTATION
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <stdlib.h>

void abort(void);


DESCRIPTION

abort terminates program execution abnormally. Open files are not closed before termination.


RETURN VALUE

Control is never returned to the caller of abort .


CAUTION

If you call abort without closing files, data in the files may be lost. In addition, an open UNIX style output file will be unchanged if you call abort . See I/O Functions for a definition of a UNIX style file.


IMPLEMENTATION

abort terminates by raising the SIGABRT signal. If a handler is not defined for this signal, SIGABRT causes program termination with a user ABEND code of 1210. See Signal-Handling Functions for more information about the SIGABRT signal.


EXAMPLE

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

main()
{
   char *passwd, reply[40];
   passwd = "SAS";

   puts("Passwd? ");
   gets(reply);

   if (strcmp(passwd,reply)){
     puts("Password incorrect; execution terminating abnormally.");
     fclose(stdout);
     abort();
   }

   puts("Password is correct.");
}


RELATED FUNCTIONS

abend


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.