char* timeNew = _com_util::ConvertBSTRToString(cpi->getTime());
if(timeFirst == true)
{
strcpy(timeOld,timeNew);
timeFirst = false;
}
how can I initiliase timeold if I dont know what the size of character array returned by cpi->getTime is?
Allocate memory for it based on length of
timeNew:or you could make
timeOldastd::stringand let it manage memory for you:You can access the
const char*usingstd::string::c_str()if really required.