C++ "cannot add two pointers", das hinzufügen einer hartcodierten Zeichenfolge zu einem CString

Bekomme ich diesen Fehler Recht oft, wenn ich versuche, so etwas zu tun

CString filePath = theApp->GetSystemPath() + "test.bmp";

Der compiler sagt mir

error C2110: '+' : cannot add two pointers

Aber wenn ich es ändern auf dieser unter es funktioniert?

CString filePath = theApp->GetSystemPath();
filePath += "test.bmp";

Die Funktion GetSystemPath gibt einen LPCTSTR wenn, dass hat nichts damit zu tun

  • was happends, wenn Sie es ändern, um CString(theApp->GetSystemPath()) + CString("test.bmp"); ?
InformationsquelleAutor | 2013-05-01
Schreibe einen Kommentar