I am able to read char into char[2] in OCI C++ code, but I am not able to read to char[1]?
Does anyone have any idea why?
(oracle data type is char(1))
I am able to read char into char[2] in OCI C++ code, but I am not able to read to char[1]?
Does anyone have any idea why?
(oracle data type is char(1))
Possibly you need space for the null character at the end of the string?
If the input is being treated like a string, then room is needed to apply the null-termination (a '\0'
) at the end. That is if the data is 'a'
, then the string representation ("a"
) is stored in memory as two characters 'a'
and '\0'
. The '\0'
is needed to tell the usual string processing suspects where the string ends.
Without knowing anything about the tools you're using I can't say for sure, but you might be able to assign to a character variable (as opposed to a character array variable).
Looking briefly at the docs along the link you posted, I suspect that you should be using std::string
as the receiving type for textual data.