How can I convert a std::basic_string type to an array of char type?

后端 未结 2 1918
情歌与酒
情歌与酒 2021-02-15 01:06

I get the following error when this code is run:

syslog(LOG_ERR | LOG_USER, \"%s\",errorString);

cannot convert ‘const string {a

2条回答
  •  北恋
    北恋 (楼主)
    2021-02-15 01:23

    I found that std::basic_string has an item access method c_str() which seems to fix the compiling issue.

    Here is a site with more information: http://en.cppreference.com/w/cpp/string/basic_string

提交回复
热议问题