Closed Taymindis closed 7 years ago
I have tried select some data and display by using xxx->value.asBytes.ptr, some is empty some is invalid character comeout
If the data are printed as printf("xxx value is: %s\n", xxx->value.asBytes.ptr)
, use printf("xxx value is: %.*s\n", xxx->value.asBytes.length, xxx->value.asBytes.ptr)
instead.
Kubo has it right. Almost all of the strings in ODPI-C use pointer/length semantics, not null-termination. This is to handle encodings like UTF-16. Unless otherwise stated, you should assume that there is no null byte terminating strings.
Just tested Kubo Suggestion, it is working fine now.
Please init 0 for last byte while initialize xxx->value.asBytes.ptr. It always display the weird thing at the last character. For example strIngColval->value.asBytes.ptr[strIngColval->value.asBytes.length] = 0;