SQLite C/C++ API unsigned char *

前端之家收集整理的这篇文章主要介绍了SQLite C/C++ API unsigned char *前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
为什么sqlite C/C++ API为文本值返回unsigned char * s而不是更实际的char *类型?

这与the unsigned char问题有些相关,除了sqlite API的决定似乎与为类字符串值给出的传统char *建议相反.

例如:

const unsigned char *sqlite3_column_text(sqlite3_stmt*,int iCol);

解决方法

SQLite documentation

(H13821) The sqlite3_column_text(S,N) interface converts the Nth column in the current row of the result set for the prepared statement S into a zero-terminated UTF-8 string and returns a pointer to that string.

UTF-8希望字节值范围从0x00到0xFF. char的范围可以是-0x80到0x7F(有符号)或0x00到0xFF(无符号).强制无符号允许正确编码UTF-8字符串.

@H_404_36@

猜你在找的Sqlite相关文章