home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / WINLBSRC.ZIP / ASSERT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  866 b   |  33 lines

  1. /*------------------------------------------------------------------------
  2.  * filename - assert.c
  3.  *
  4.  * function(s)
  5.  *        __assertfail - prints error message and aborts
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #include <alloc.h>
  18. #include <stdio.h>
  19. #include <string.h>
  20. #include <assert.h>
  21. #include <_win.h>
  22.  
  23. void _FARFUNC __assertfail( char _FAR *msg, char _FAR *cond, char _FAR *file, int line )
  24. {
  25.     char *errMsg = malloc( strlen( msg ) + strlen( cond )
  26.                            + strlen( file ) + 6 );
  27.     if( errMsg == 0 )
  28.         errMsg = "Assertion failed";
  29.     sprintf( errMsg, msg, cond, file, line );
  30.     _errorExitBox( errMsg, 3 );
  31. }
  32.  
  33.