我正在扫描硬盘中的一些文件,我正在使用下面的简单代码将它们放到DB中。
std::stringstream ss;
ss << "INSERT INTO `test`.`file` ( `name`, `directory`, `size`, `extension`, `read_permission`, `write_permission`,`execute_permission`, `c_time`,`a_time`,`m_time`) VALUES ("<< "'"
<< app.e.name << "', " << "'"
<< app.e.directory << "', " << "'" << app.e.size << "', " << "'" << app.e.extension << "', " << "'"
<< app.e.read_permission << "', " << "'" << app.e.write_permission << "', " << "'" << app.e.execute_permission << "', " << "'"
<< app.e.creation_time << "', " << "'" << app.e.execution_time << "', " << "'" << app.e.modification_time << "'); ";
但是,我的硬盘中的某些文件包含非utf 8字符,如
['Ö','Ç','Ş','ı','Ğ']
并抛出异常:
“0x60a9d540(msvcr100d.dll)中的未处理异常” DigitalForensicsVisualisation.exe:0xC0000005:访问冲突 读取位置0x00000000。“
有没有办法将这些字符存储在字符串流中?
或者是字符串流的任何其他替代数据结构,允许在一行中进行多个连接。