You can use this piece of code. This is untested code. Please revert if you have any queries
char *lpFirstOccurance = NULL;
char buffer[1024];
char temp1[500];
lpFirstOccurance = (CHAR*)strstr(buffer, "\\SystemRoot");
if(strlen(buffer) > 0 && lpFirstOccurance != NULL)
{
lpFirstOccurance += strlen("\\SystemRoot");
sprintf(temp1, "%ls%s",tempStr.c_str(), lpFirstOccurance);
}