I get the following error when this code is run:
syslog(LOG_ERR | LOG_USER, \"%s\",errorString);
cannot convert ‘const string {a
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
The c_str()
or data()
member function provides a pointer to the first element of an array of char_type
which contains your string. It's valid as long as the string object itself remains valid and unchanged (but beware that operations that may cause reallocations may invalidate the pointer -- best not to store it).