Jaf
Posts: 70
Joined: 2/1/2006 Status: offline
|
When calling the API you sometimes get a result of OK, but an "inner result" of R_BUFFERTOOSMALL. When this happens the returned string is blank. What this is telling you is that the fixed-size buffer you passed to the API to receive the result is in fact too small for the results generated. When this happens the API returns the status R_BUFFERTOOSMALL, but is still holding onto the result internally in it's own buffer. You can access this result (without having to re-do the conversion) by taking the following steps - call CONVERTER_GetOutCharArraySize to determine what size buffer is required - allocate a new buffer of that size - make a call to CONVERTER_GetOutCharArray_Ptr passing the new buffer and it's size to retrieve the stored results. A good rule of thumb is that the output buffer used to receive the results should be at least equal to the size of the input buffer, so in most cases allocating an output buffer equal in size to the input string should be more than adequate. That is because in most cases when converting to text the output is smaller than the input. However this isn't always the case as sometimes table layouts cause the resulting text to be padded out. This issue is discussed in the API documentation in the section "Checking the conversion results when using (char *) pointers" where there is also some sample code. See http://www.jafsoft.com/doco/api_manual.html#checking_the_conversion_result__che02407 I have recently improved the VB example to include this type of logic (though it isn't yet in the current online samples). I will probably update the C# sample as well. If you need sample code, feel free to email me to see if I have any available.
|