NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send a string to CVI .c and get string return through TestStand sequence?

Hi, I am using TestStand 3.1 and I have the StringConverter.c with CVI 8.0 with the function:
 
char * string_concat_2 (char* str1,char* str2)
{
 char * str_ret;
 
 str_ret = calloc(200, sizeof(char*));
 
 str_ret = strcat (str_ret, str1);
 str_ret = strcat (str_ret, str2);
 
 return str_ret;
}
 
I would like to use it  through Teststand, so I add a sequence using 'StringValueTest'. I Spectify Module CVI &  link to StringConverter.c and type in Function Name: char * string_concat_2 (char* str1,char* str2)
1. How I define to send the string1 ("Hello") & string2 ("World") to the Module?
2. How I define to string return ("HelloWorld" from the Module?
 
Thanks

0 Kudos
Message 1 of 3
(3,689 Views)
Hi plit string,

You will need to have a parameter passed by reference to return the string.  To do this, use a "C String Buffer" instead of a "C String (const)" parameter type.  There is documentation on this in TestStand Help.  Here is a quote from there:

"
When using string parameters, use the C String Buffer or Unicode String Buffer type if you want the function to be able to change the contents of the argument in TestStand. Use the C String or Unicode String type if the DLL function does not modify the argument. You can pass a literal string, a TestStand string property, or an expression that evaluates to a string as the value of a string parameter."
Gavin Fox
Systems Software
National Instruments
0 Kudos
Message 2 of 3
(3,673 Views)

Sorry about my late reply, since I had holidays. I changed as you suggested and it works. However only after I did Edit Source Code in Specify Module ---> it created automatically the tscvirun_supp.c

Thanks for help Smiley Happy

0 Kudos
Message 3 of 3
(3,625 Views)