CPB Mailing List
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TRACE in BCB
> Dear Sirs,
> How could I use Borland's TRACE and WARN
> macros in BCB? They are available in BC5.02 and I
> want them in BCB programs.
>
> Any help will be warmly appreciated.
1.1 Is there an easy way to trace my program execution?
BCB provides two easy to use macros (TRACE and WARN) which log
messages to a file called OutDbg1.txt. Inside the IDE, the file
will automatically pop up in the edit window if used. The macros
use C++ streams so you can do stuff like:
TRACE("foo = " << foo << ", bar = " << bar);
WARN(x != y, "x(" << x << ") != y(" << y << ")");
To get the macros, you need to include the header file checks.h and
define __TRACE and __WARN before including the file. To turn off
the debugging output, simply undefine __TRACE and __WARN. Note that
the difference between TRACE and WARN is that WARN takes a
conditional first parameter, and the message is logged only if the
condition is satisfied. The traditional assert macro is also
available for console apps.
W Komornicki's Home Page |
Main Index |
Thread Index