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 ??
Asked
Active
Viewed 3,303 times
0
-
3Varies a little by platform, but there's likely a `mkdir()` function you can use. – Dmitri Jul 12 '15 at 20:00
-
What platform are you using - Unix or Windows? Can you post some sample code that you've tried? – mjturner Jul 12 '15 at 20:00
-
I am using windows. Friend i can find a solution from another friend named uditr043. – Md Zobayer Jul 13 '15 at 22:26
1 Answers
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
-
1friend 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