How to put stringstream contents into char instead string type?

后端 未结 4 659
滥情空心
滥情空心 2021-01-17 21:10

Every one know stringstream.str() need a string variable type to store the content of stringstream.str() into it .

I want to store the cont

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-17 21:19

    I figured it out. Using namespace std and replacing tstingstreamwith stringstream. Next step is: stringstream strstream; strstream.imbue(std::locale("C")); string str = strstream.str(); const char *sql= str .c_str(); Now you can execute sql statement.

    sqlite3_exec(db, sql, callback, (void*)data, &zErrMsg);
    

    Maybe it helps to somebody.

提交回复
热议问题