LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string length

Solved!
Go to solution

Hi,

 

i'm using a .dll which requires a string of a certain length.

 

the c++ code in the source of the .dll is:

 

char buffer[81] = {0};

strncpy(buffer, tagname.c_str(), sizeof(buffer));

m_errorcode = pipt_findpoint(buffer, &pointid);

 

Got anyone an idea how i can create stings of 81 characters?

 

Thanks

0 Kudos
Message 1 of 4
(2,981 Views)
Solution
Accepted by topic author BigBadWolf

Create an array of U8 and then use the Byte Array to String function.

 

However, your C code seems to imply the memory allocation is being done inside the DLL, rather than in LabVIEW. If so, allocating the string in LabVIEW is rather pointless.

 

Also, be aware that pure C++ DLLs are not supported by LabVIEW. You may run into name mangling issues. See Writing Win32 Dynamic Link Libraries (DLLs) and Calling Them from LabVIEW and Function Not Found in Library Error When Using the Call Library Function Node.

0 Kudos
Message 2 of 4
(2,972 Views)

Hi,

Something like that ? Maybe that's not a very smart way to that but it's OK...

Best,

J.

0 Kudos
Message 3 of 4
(2,966 Views)

Oups sorry I have seen smercurio answer later, the way he did that is better. 🙂

0 Kudos
Message 4 of 4
(2,963 Views)