// ttstrをUTF8文字列へ変換 std::string convertTtstrToUtf8String(ttstr &buf) { int maxlen = buf.length() * 6 + 1; char *dat = new char[maxlen]; int len = TVPWideCharToUtf8String(buf.c_str(), dat); std::string result(dat, len); delete[] dat; return result; }
/** * パスをローカル化する&末尾の\を削除 * @param path パス名 */ static void getLocalName(ttstr &path) { TVPGetLocalName(path); if (path.GetLastChar() == TJS_W('\\')) { tjs_int i,len = path.length(); tjs_char* tmp = new tjs_char[len]; const tjs_char* dp = path.c_str(); for (i=0,len--; i<len; i++) tmp[i] = dp[i]; tmp[i] = 0; path = tmp; delete[] tmp; } }