#include #include #include // パスを正規化する関数 char* normalizePath(const char* path) { char* resolvedPath; char* normalizedPath; // _fullpath は、相対パスを絶対パスに変換する関数です resolvedPath = _fullpath(NULL, path, 0); if (resolvedPath == NULL) { fprintf(stderr, "Error resolving path.\n"); return NULL; } // パスを正規化 normalizedPath = _fullpath(NULL, resolvedPath, 0); free(resolvedPath); if (normalizedPath == NULL) { fprintf(stderr, "Error normalizing path.\n"); return NULL; } return normalizedPath; } int main() { const char* inputPath = "C:\\Users\\user\\.\\Documents\\..\\Downloads"; char* normalizedPath = normalizePath(inputPath); if (normalizedPath != NULL) { printf("Input Path: %s\n", inputPath); printf("Normalized Path: %s\n", normalizedPath); free(normalizedPath); } return 0; }