TCHAR tmp[255]; ::GetCurrentDirectory(255, tmp); // 현재 절대 경로를 구해옴 CT2CA pszConvertedAnsiString(tmp); std::string strGetRear(pszConvertedAnsiString); std::string strGetFront("../../Directory/"); // 테스트용 상대 경로 CString strFront = CString(strGetFront.c_str()); CString strRear = CString(strGetRear.c_str()); while(strRear.Find(_T("../"), 0) >= 0 || strRear.Find(_T("..\\"), 0) >= 0) { int _left = strFront.ReverseFind(_T('\\')); strFront = strFront.Left(_left); int _len = strlen("../"); int _right = 0; if(strRear.Find(_T("../"), 0) >= 0) _right = strRear.GetLength() - strRear.Find(_T("../"), 0) - _len; else if(strRear.Find(_T("..\\"), 0) >= 0) _right = strRear.GetLength() - strRear.Find(_T("..\\"), 0) - _len; strRear = strRear.Right(_right); } CString strTemp = strFront + L"\\" + strRear; CT2CA pszConvertedAnsiString(strTemp); std::string strPath(pszConvertedAnsiString); // 최종 Path