Jump to content

How can I pass specific cluster(struct) to my c++ application from


Recommended Posts

Hi All;

I have a separated projects in c++ and labview and which have to share dynamically created data each other. I have tried socket usage on UDP and can send string data via socket from Labview to c++ app. But I don't know how can I pass cluster (in c++ struct) data from labview.

Could anyone show me or give me any reference about kind of these operations to make me achieve?

Thanks in advance.

Umit Uzun

Link to comment

QUOTE (Umit Uzun @ Apr 21 2009, 02:44 AM)

Hi All;

I have a separated projects in c++ and labview and which have to share dynamically created data each other. I have tried socket usage on UDP and can send string data via socket from Labview to c++ app. But I don't know how can I pass cluster (in c++ struct) data from labview.

Could anyone show me or give me any reference about kind of these operations to make me achieve?

Thanks in advance.

Umit Uzun

Use the LabVIEW "Flatten to String" function - this will serialize a LabVIEW data cluster into a byte stream that can then be unpacked by the C++ app into a C++ struct - for example

LabVIEW cluster: Numeric (Double), Numeric (U32 Int), Array (U16) (note that this must be a populated array of the same size as the target struct)

to pass this to a struct of

struct LVData

{

double x;

int y;

short array[100];

};

Then just wire the cluster up to flatten to string (wire a false constant into the "prepend array or string size? " control) and then pass the flattened string to your C++ app. Now that app will have to deserialize into a struct.

Mark

Link to comment

QUOTE (mesmith @ Apr 21 2009, 03:40 PM)

Use the LabVIEW "Flatten to String" function - this will serialize a LabVIEW data cluster into a byte stream that can then be unpacked by the C++ app into a C++ struct - for example

LabVIEW cluster: Numeric (Double), Numeric (U32 Int), Array (U16) (note that this must be a populated array of the same size as the target struct)

to pass this to a struct of

struct LVData

{

double x;

int y;

short array[100];

};

Then just wire the cluster up to flatten to string (wire a false constant into the "prepend array or string size? " control) and then pass the flattened string to your C++ app. Now that app will have to deserialize into a struct.

Mark

Hi Mark;

Thanks so much. I have resolved the problem with your awesome directions :thumbup:

Best Regards.

Umit Uzun

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.