0

I am a beginner C Programmer. I can make file (example .txt,.html etc) but now i try to make a directory in a specific location. But i can't success. Can any one help me to make directory with example ??

Md Zobayer
  • 59
  • 3
  • 8

1 Answers1

3

For linux

mkdir("/some/directory", 0700);

For Windows

int main()
{
   system("mkdir C:\\Windows\\test");
}

I don't know what you mean by FILE IO but fopen doesn't create folder it just returns NULL if folder doesn't exists.

udit043
  • 1,610
  • 3
  • 22
  • 40
  • 1
    Using `system()` for simple filesystem operations is very bad idea. – myaut Jul 13 '15 at 09:02
  • 1
    friend myaut please tell a good idea for simple filesystem operation. and Advance thanks – Md Zobayer Jul 13 '15 at 22:47
  • 1
    @MdZobayer Rather than using `system()`, you should use the `_mkdir()` or `_wmkdir()` functions. For some reason this answer links to the documentation for them, but uses `system()` instead in its example code. – Dmitri Jul 14 '15 at 01:17