Hi all,
I was wondering if anyone could help me with calling the Notes C API function ldap_get_dn from LotusScript. It returns a pointer to a null terminated string (LMBCS i assume) if successful, or a null pointer if not successful. Also I need the pointer value to free up the memory being used by the string using ldap_memfree. I have no idea how long the string is without searching for the trailing null, or what its maximum size could be. This is vaguely how I expect to proceed.
-
Get the pointer, ptr = ldap_get_dn(ld, entry).
-
If ptr = 0 stop and report error.
-
Find out the length of the LMBCS string in characters (preferably not bytes) using some function which understands LMBCS strings and looks for the null.
-
Allocate a LotusScript string that is big enough to hold the string using the value derived in step 3 above.
-
Copy/Translate the LBMCS string to the LotusScript unicode string.
-
Free up the original memory using ldap_memfree(ptr)
I know how to do steps 1, 2, 4, 6, but I need help with steps 3 and 5. Assuming my logic is correct of course.
thanks in advance,
Jim