#include #include void getShortPath(const WCHAR* longPath, WCHAR* shortPath) { // 短いパス名の取得 GetShortPathName(longPath, shortPath, MAX_PATH); } void getLongPath(const WCHAR* shortPath, WCHAR* longPath) { // 長いパス名の取得 GetFullPathName(shortPath, MAX_PATH, longPath, NULL); } int main() { WCHAR longPath[MAX_PATH]; WCHAR shortPath[MAX_PATH]; // 長いパス名から短いパス名を取得 getShortPath(L"C:\\Program Files\\test\\test.txt", shortPath); wprintf(L"Long Path: %s\n", L"C:\\Program Files\\test\\test.txt"); wprintf(L"Short Path: %s\n", shortPath); // 短いパス名から長いパス名を取得 getLongPath(shortPath, longPath); wprintf(L"Short Path: %s\n", shortPath); wprintf(L"Long Path: %s\n", longPath); return 0; }