How to create folder (directory) in C

1 Answer

0 votes
#include <dir.h>
#include <stdio.h>

int main(void) {
   char *dirname = "d:\\test";

   int rv = mkdir(dirname);
   if (!rv) {
      printf("Directory created\n");
   }
   else {
      printf("Unable to create directory\n");
   }
   
   return 0;
}


     
/*
run:
      
Directory created
 
*/

 



answered Jul 2, 2020 by avibootz

Related questions

2 answers 261 views
261 views asked Sep 28, 2015 by avibootz
1 answer 180 views
2 answers 328 views
1 answer 220 views
1 answer 235 views
235 views asked Aug 2, 2018 by avibootz
3 answers 437 views
...