C# C++ 判断文件 文件夹是否存在

1. C# 判断文件/文件夹是否存在

       在引用中添加  :

            using System.IO;
            string strFileName = "filePath";
            if (Directory.Exists(strFileName))
            {
                //判断文件夹是否存在
            }

            else if (File.Exists(strFileName))
            {
                //判断文件是否存在
            }


2. C++ 判断文件/文件夹 是否存在

            #include <iostream.h>
            string strFileName = "filePath";

            if (PathIsDirectory(strFileName))
            {
                //判断文件夹是否存在
            }

            if (PathFileExists(strFileName))
            {
                //判断文件是否存在
            }



你可能感兴趣的:(C++,C#,文件,文件夹)