robijn Posted July 5, 2007 Report Share Posted July 5, 2007 It seems like the C string parameter is now behaving slightly different on the DLL call. I have a function that requires a prealocated space, so I supply it with a string of sufficient length and tell the function in the next parameter how much space it is allowed to use. There is a difference between how LV 7.1.1 handles the returned string and how LV8.2 does that. The former leaves the string unbothered, even if there are null characters in it. LV 8.2 seems to think "it's a C string, so a 0 means end of string" and consequently it cuts the string just before this 0 character. This is usually good, but not always: often we knew that a C string was the same as a C U8 array so we used strings as medium to transfer bytes even if they could be zero. It seems we cannot do that anymore in LV8. Well, maybe it's better this way. Joris Quote Link to comment
Rolf Kalbermatter Posted July 6, 2007 Report Share Posted July 6, 2007 QUOTE(robijn @ Jul 4 2007, 10:44 AM) It seems like the C string parameter is now behaving slightly different on the DLL call. I have a function that requires a prealocated space, so I supply it with a string of sufficient length and tell the function in the next parameter how much space it is allowed to use. There is a difference between how LV 7.1.1 handles the returned string and how LV8.2 does that. The former leaves the string unbothered, even if there are null characters in it. LV 8.2 seems to think "it's a C string, so a 0 means end of string" and consequently it cuts the string just before this 0 character. This is usually good, but not always: often we knew that a C string was the same as a C U8 array so we used strings as medium to transfer bytes even if they could be zero. It seems we cannot do that anymore in LV8. Well, maybe it's better this way. I was pretty sure that LabVIEW terminated strings on return on the first NULL character already in LabVIEW 7 and I think even in LabVIEW 6. I did rely in 6.x several times on that, so not sure why you would see something else. If that is not desired you need to use byte arrays. Rolf Kalbermatter Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.