#include #include int main() { // ファイルの存在を確認する例 const char* file_path = "C:\\Users\\SEEDAGX\\source\\repos\\FileExists\\FileExists\\FileExists2.c"; if (GetFileAttributesA(file_path) != INVALID_FILE_ATTRIBUTES) { printf("ファイルが存在します。\n"); } else { printf("ファイルが存在しません。\n"); } // ディレクトリの存在を確認する例 const char* dir_path = "C:\\Users\\SEEDAGX\\source\\repos\\FileExists"; DWORD ftyp = GetFileAttributesA(dir_path); if (ftyp != INVALID_FILE_ATTRIBUTES && (ftyp & FILE_ATTRIBUTE_DIRECTORY)) { printf("ディレクトリが存在します。\n"); } else { printf("ディレクトリが存在しません。\n"); } return 0; }