Create a folder to another folder in C programming

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
472 B
6
Indexable
Never

#code by: https://stackoverflow.com/users/7066658/ali

#include <stdio.h>
#include<windows.h>
int main() {

   const char *user_inputs[] = {"name1","name2"};
   size_t input_len = (int)( sizeof(user_inputs) / sizeof(user_inputs[0]) );
   
   int i;
   
   char base_path[] = "C:\\";
   
   char new_path[80];
   
   for (i=0; i < input_len; i++) {
    	
    	strcat(base_path, "\\\\");
    	strcat(base_path, user_inputs[i]);

    	CreateDirectory(base_path, NULL);
	}

}