Using GetCurrentDirectory
to have a full path and roll back to where you want to stay with standard C++ string API. Here is my sample code for your reference.
int main() {
TCHAR current_dir_wc[MAIN_FN_LEN_LIMIT];
char current_dir[MAIN_FN_LEN_LIMIT];
char project_dir[MAIN_FN_LEN_LIMIT];
GetCurrentDirectory(MAIN_FN_LEN_LIMIT, current_dir_wc);
sprintf(current_dir, "%s\\", wc2str(current_dir_wc).c_str());
strncpy(project_dir, (const char*)current_dir, (strstr((const char*)current_dir, "UR_VS_SOLUTION_NAME")-current_dir+strlen("UR_VS_SOLUTION_NAME\\")));
printf("[%s]Current DIR:%s\n", __func__, current_dir);
printf("[%s]Project DIR:%s\n", __func__, project_dir);
}