nasserkhan
Electrical
- Aug 9, 2005
- 1
I am using Labview as an interface for my C++ program, which I have converted into a DLL. I am taking a C++ style string, then converting it to a 'C' style string (using c_str() function), casting it to a char *. I then return it, with the intention that Labview should output the string to a textbox. Instead Labview just puts in the textbox a bunch of 'Y's with accents over them. Here's a snippet of what I'm doing:
string problems = func1(...); //func1 returns a C++ string
char *badpins = (char *)problems.c_str();
badpins[problems.length()] = '\0'; //I've tried with
//and without this line, it doesnt make a difference
return badpins;
//labview textbox produces junk
but if i just do:
char *badpins = "hello";
return badpins
//labview outputs 'hello' to textbox
I don't see any reason why there should be difference results for those 2 scenarios. Can someone show me a way to get Labview to output my C++ string???
Thanks in advance.
string problems = func1(...); //func1 returns a C++ string
char *badpins = (char *)problems.c_str();
badpins[problems.length()] = '\0'; //I've tried with
//and without this line, it doesnt make a difference
return badpins;
//labview textbox produces junk
but if i just do:
char *badpins = "hello";
return badpins
//labview outputs 'hello' to textbox
I don't see any reason why there should be difference results for those 2 scenarios. Can someone show me a way to get Labview to output my C++ string???
Thanks in advance.