1
我有提起表,其中,值存储为BLOB类型。我需要将它作为二进制数组,以便我可以从BLOB中的不同字节位置获取不同的值。任何帮助表示赞赏。BLOB到字节阵列转换目标C
我有提起表,其中,值存储为BLOB类型。我需要将它作为二进制数组,以便我可以从BLOB中的不同字节位置获取不同的值。任何帮助表示赞赏。BLOB到字节阵列转换目标C
// Get the start and length of the blob.
// (remember column indexes are 0-based when fetching the value
// but 1-base when binding - yeah cheers!)
uint8_t *data = (uint8_t *)sqlite3_column_blob(stmt, columnIndex);
size_t length = (size_t)sqlite3_column_bytes(stmt, columnIndex);
// And now you can access the data
unsigned sum = 0;
for (size_t i = 0; i < length; i++)
sum += data[i];
感谢您的回复,我会很快确认答案 –