JohnOne Posted March 1, 2014 Posted March 1, 2014 I am using some C/++ functions that require a cstring to be double null terminated. My question is, does AutoIt do this internally? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Mat Posted March 1, 2014 Posted March 1, 2014 I wouldn't rely on it. But you can always just at Chr(0) on the end manually. JohnOne 1 AutoIt Project Listing
JohnOne Posted March 1, 2014 Author Posted March 1, 2014 Cheers, been trying that with 2 of them but alas, not getting any joy. Probably something else wrong with my code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
trancexx Posted March 1, 2014 Posted March 1, 2014 Autoit will ignore all characters after the null-terminator, so your second null won't get thru. Just use two two characters bigger dllstruct and fill it with the original string. Have in mind that binary code will receive passive buffer and not actual CString, so for anything done on it you have to use copy constructor to create real CString that you can work on. JohnOne 1 ♡♡♡ . eMyvnE
JohnOne Posted March 1, 2014 Author Posted March 1, 2014 Have in mind that binary code will receive passive buffer and not actual CString, so for anything done on it you have to use copy constructor to create real CString that you can work on. I'll have to confess to not knowing what exactly this means. I'm I to assume that with a struct say "wstr[256]" that the whole thing will get through filled with just 128 char string? It's quite odd really because I wrapped the function in C/++ myself in a dll, and called it without a problem, but calling directly from AutoIt fails. So I must assume there is problem with my struct or other code, which I'll post up if I cannot figure out this morning. Thanks for help folks. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
trancexx Posted March 1, 2014 Posted March 1, 2014 There is no such thing as wstr[] in AutoIt, probably you meant wchar[]. If you want to pass string in len of 5 characters and want it to be double-null-termninated then create struct in size of 7 characters and fill it with the string. Last two characters will be null-s, because AutoIt zero-out allocated space anyway. JohnOne and Danyfirex 2 ♡♡♡ . eMyvnE
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now