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 C

A 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);
}

 

 

Valid HTML 4.01 Transitional Valid CSS
Yahoo! Search
Search the web Search this site
View content labeling at ICRA.