|
25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more... |
Home Projects Up Sitemap Search Blog Forum+Chat About Us Privacy Terms of Use Feedback FAQ Images Services Payments Humor Music |
Procedural utility functions in DeSmet CA DeSmet C abort() function for abnormal program termination. It prints an error message to stderr, closes all open files, and exits. I thought there were going to be more functions to include for this category on this page, but there weren't. |
/* ===========================================================*/
/* PROCEDURAL UTILITY FNS */
/* ===========================================================*/
/* ----------------------------------------------------------------------- */
/* ABORT() 6-4-87 5-9-94 */
/* Copyright (C)1987, 1994 Steven Whitney. Published under the */
/* GNU GPL (General Public License) Version 3, with ABSOLUTELY NO WARRANTY. */
/* Initially published by http://25yearsofprogramming.com. */
/* aborts program execution after printing appropriate explanatory error message */
/* ----------------------------------------------------------------------- */
#define stderr (2)
#define ERR (-1)
int abort(s)
char *s;
{
fputs("\n",stderr);
fputs(s,stderr);
fputs("\n",stderr);
if(closeall() == ERR)
fputs("Error closing data files. Possible data loss.\n",stderr);
exit(1);
}
|
|
|
|
|
Copyright ©2011 Steven Whitney. Last modified Tue 05/24/2011 12:26:52 -0700. |
||