Создание Файла, который не делает Путь, существует?

Обычно будет один.h файл для каждого .c/.cpp файла.

21
задан bluish 10 June 2014 в 09:17
поделиться

3 ответа

Try

Directory.CreateDirectory(@"C:\MyApp\MySubDir\Data")

http://www.devx.com/vb2themax/Tip/18678

37
ответ дан 29 November 2019 в 06:32
поделиться

You will need to create the Directory first. It will create all of the subdirectories that don't exist within the path you send it. It's quite a powerful piece of functionality.

Directory.CreateDirectory(filePath);

If you don't know whether the directory exists or not you can use Directory.Exists. But not for this case as it would be pointless. MSDN states that CreateDirectory does nothing if the directory currently exists. But if you wanted to check existance of the directory for another reason you can use:

  if(Directory.Exists(folder) == false)
    {
    //do stuff  
    }
5
ответ дан 29 November 2019 в 06:32
поделиться
Directory.CreateDirectory("path");
1
ответ дан 29 November 2019 в 06:32
поделиться
Другие вопросы по тегам:

Похожие вопросы: