Home arrow Support arrow Gurock Software Forum arrow General Discussion arrow Some example in C++Builder 2k6

Subscribe to forum RSS Forum

Some example in C++Builder 2k6

New Topic Post Reply

Page: 1

Author Post
Giuseppe Monteleone
Guest
How can add paramter in a string ?

usually with delphi version I can Do

SiMain.LogDebug('something %d',[value]);

I try equivalent C++

SiMain->LogDebug("something %d",value);

but does not work.

I need to create an external TVarRec all times ?

Thanks
Ing Giuseppe Monteleone
Administrator
Registered: Sep 2007
Posts: 133
Hello Giuseppe,

you need to pass an explicit TVarRec argument to the LogDebug function when using a format string and array. This is similar to the behavior of the standard Format routine of Borland C++.

Fortunately, there is a C++ macro makes this a bit easier. It is called OPENARRAY and takes two arguments. The first is the array type (in our case TVarRec) and the second is the array itself.

So, when calling LogDebug with a format string, you can call it like this:

SiMain->LogDebug("something %d", OPENARRAY(TVarRec, (value)));

By the way, the SmartInspect installation comes with a set of live templates for BDS 2006 (including C++). Among others, there are templates for the functions which take a format string (LogDebug, LogVerbose etc.). For installation help, please have a look at our templates knowledge base article:

http://www.gurock.com/support/kb/9/

After installing the templates, you can enter "sidebf" in the code editor and expand this template by pressing Strg+J.

New Topic Post Reply

Page: 1