06-20-2005 02:12 PM
06-20-2005 05:13 PM - edited 06-20-2005 05:13 PM
@abriggs8 wrote:
Hi, I am wiring a cluster that holds a string into a Call External Library Node and following the "Adapt to Type" article and "Calling External Code in LabVIEW" manual, I have created a .cpp file with this code in it:
typedef struct {
double Numeric;
double Numeric2;
LStrHandle String;
} TD1;
However, I am using a function that requires a C++ string to be passed into it and it returns a C++ string that needs to be assigned to LStrHandle String. Is it possible to convert the LStrHandle format into a C++ string and vice versa? I found something regarding the LStrPrintf functions, but I'm fairly new with programming and I did not follow it very well. Thank you in advance.
Message Edited by rolfk on 06-20-2005 05:15 PM
06-21-2005 01:37 AM
@abriggs8 wrote:
Hi, I am wiring a cluster that holds a string into a Call External Library Node and following the "Adapt to Type" article and "Calling External Code in LabVIEW" manual, I have created a .cpp file with this code in it:
typedef struct {
double Numeric;
double Numeric2;
LStrHandle String;
} TD1;
However, I am using a function that requires a C++ string to be passed into it and it returns a C++ string that needs to be assigned to LStrHandle String. Is it possible to convert the LStrHandle format into a C++ string and vice versa? I found something regarding the LStrPrintf functions, but I'm fairly new with programming and I did not follow it very well. Thank you in advance.
06-21-2005 12:51 PM
06-21-2005 04:38 PM
@abriggs8 wrote:
Hi rolfk, that helps me out a great deal. It was much easier to understand than most explanations I've gotten. However, the line that reads:
string s(LStrBuf(*handle), 0, LStrLen(*handle));
is giving me a compile error. It says that it cannot convert parameter 1 from 'uChar*__w64' to 'const std::basic_string<_Elem,_Traits,_Ax>::_Myt'. I'm guessing the LStrBuf function is not returning the proper data type(which appears to be a C++ string) to be passed into the constructor there. I'm unfamiliar with that function so I'm not sure how to proceed to fix this. How might I proceed to do this? Again, thank you in advance for the advice.