c2678 compile error


i get an error for the following code
error C2678: binary '+' : no operator found which takes a left-hand operand of type 'const char [5]' (or there is no acceptable conversion)

Here is the code:
BOOL CSerialCom::OpenPort(CString portname)
{
portname= "//./" +portname;

hComm = CreateFile(portname,
GENERIC_READ | GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
0,
0);
if(hComm==INVALID_HANDLE_VALUE){
//MessageBox("Cannot open Communication Port.Please\nQuit the program and Re-start your PC.","Com Port Error",MB_OK+MB_ICONERROR);
return false;}
else
return true;

}

I have tried adding #include <cstring> but still does not work

am i missing something, I am currently using visual studio 2005
closed account (3hM2Nwbp)
Check out http://www.cplusplus.com/reference/clibrary/cstring/

I didn't see any operator+ overloads, try
 
char * strcat ( char * destination, const char * source );
Topic archived. No new replies allowed.