Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以在OCI C++代码中将 char 读入 char[2] ,但我无法读入 char 1?
有谁知道为什么?
(oracle 数据类型为 char(1))
如果输入被视为字符串,则需要'\0'在末尾应用空终止 (a) 的空间。也就是说,如果数据是'a',那么字符串表示 ( "a") 将作为两个字符'a'和存储在内存中'\0'。'\0'需要告诉通常的字符串处理嫌疑人字符串在哪里结束。
'\0'
'a'
"a"
在不了解您正在使用的工具的情况下,我不能肯定地说,但您可能能够分配给字符变量(而不是字符数组变量)。
简要查看您发布的链接中的文档,我怀疑您应该将其std::string用作文本数据的接收类型。
std::string
字符串末尾的空字符可能需要空格吗?