I have the next piece of code:
vector<ChatSession> ssid;
void SessionCreator( void *ch )
{
vector<string> users;
...
...
...
ChatSession cs;
// put chat session objects in vector array
for (int i = 0; i < (int)users.size(); i++)
{
const char *t = users[i].data();
char t2[30]; memcpy(t2, t, strlen(t));
cs = new ChatSession(*t2);
ssid.push_back(cs);
}
// Terminate myself
_endthread();
}
program.h:
class ChatSession
{
private:
char ChatID[100];
char Name[30];
char Message[1024];
char newMsg[1024];
bool CanSend;
public:
ChatSession();
ChatSession(char *nickname);
~ChatSession();
void SetChatID(char* id);
void Send();
char *getName();
bool ready();
};
...
...
...
extern vector<ChatSession> ssid;
VC++ throws angry error error at me: Line: cs = new ChatSession(*t2);
Error C2664: 'ChatSession::ChatSession(char *)' : cannot convert parameter 1 from 'char' to 'char *'
Please help.