04-28-2016 04:04 AM
Hello,
i created a wrapper for a ivi function and added to addtional parameters to it (Result and TXT).
It is working fine but how can i make the bold text working?
The "if" part works only problem in the else-path.
How can i set the string into the ViChar array?
Thanks for help
void __declspec(dllexport) ConfigureOutputEnabled(ViSession vi, ViInt32 index, ViBoolean enabled, ViInt32 &Result, ViChar TXT[] ) { .... Result = IviDCPwr_ConfigureOutputEnabled(vi, channelName, enabled); if (Result != 0) { IviDCPwr_error_message(vi, Result, TXT); } else { //TXT[] = "No error"; //How to change this? } }
04-28-2016 09:23 AM
If you want your dll to return the result value to the caller you should declare it as ViInt32 *Result, and use *Result in the function body.
For the string parameter, couldn't you declare it as a ViChar * and fill it with strcpy ()? I'm not using Ivi so I don't know if this is safe for IviDCPwr_error_message () function.
04-28-2016 09:29 AM - edited 04-28-2016 09:30 AM
There is no problem with Result parameter.
strcpy is not working here.
I solved it with this:
Copying index by index into the output array.
ViChar temp[] = "No error."; for(int i = 0; i < sizeof(temp); ++i) TXT[i] = temp[i];