Reputation: 51
Need to log the content of buf using the LogMethod() below the problem is that LogMethos only accepts a "Const CString&"
char buf[1024];
strcpy(buf, cErrorMsg);
// need to pass to LogMethod "buf" how do i do that?
log.LogMethod(const CString &);
Thans Rev
Reversed
Upvotes: 1
Views: 2167
Reputation: 1754
log.LogMethod(CString(buf));
This will avoid the problem where the compiler won't automatically create the CString object using the appropriate constructor since the argument is a reference (It would have if the argument was a "plain" CString).
Upvotes: 1
Reputation: 32635
If you're talking about MFC CString
, as far as I can tell, it should have a non-explicit constructor taking TCHAR const *
. In other words, the following should work.
log.LogMethod(buf);
If it doesn't, please post the error message.
Upvotes: 1