×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Issue with Labview and DLL made in C++ (string issues)

Issue with Labview and DLL made in C++ (string issues)

Issue with Labview and DLL made in C++ (string issues)

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources