forwarding of variadic arguments in CONTROL

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
2 posts • Page 1 of 1
christian.kotz@siemens.com
Posts:14
Joined: Tue Aug 07, 2018 5:11 pm

forwarding of variadic arguments in CONTROL

Post by christian.kotz@siemens.com »

Hi,

has anybody found a way to forward variadic arguments to another CONTROL function also taking variadic arguments:

The following code is syntactically OK, but does not yield the expected result: :(

Example

`sprint` as a function (no error handling here for simplicity)

Code: Select all

string strFormat(string format, ...)
{
   va_list parameters; 
   string result;   
   va_start(parameters);    // possibly not needed
   sprintf(result, format, parameters);
   va_end(parameters);      // possibly not needed 
   return result;
}
How is it done correctly? Where can I find more information on variadic arguments in CONTROL than in the help file?

I am using Win CC OA 3.12

BR
Christian

schneebergera
Posts:89
Joined: Sun Apr 03, 2016 5:52 pm

Re: forwarding of variadic arguments in CONTROL

Post by schneebergera »

Hello,

It isn't possible to pass "var-args" to built-in CTRL functions [sprintf () is a built-in CTRL function] - this is not implemented.
But it works to pass "var-args" to other USER-defined (self-written) CTRL functions.

best regards,
Andreas

2 posts • Page 1 of 1