Playing around with file streams and directory creations I stumbled upon the _mkdir command and wanted to try something. I wanted to stick that command inside a for loop and create 10 folders when ran. For obvious reasons the OS (Windows) can't have duplicated folder names so the following code only generates 1 folder named "testfolder".
Using the code below how hard would it be to generate 10 folders assigned testfolder1, testfolder2, testfolder3, etc, etc?
Also, is mkdir the best command for this? I guess if all I am trying to do is generate a bunch of empty folders at runtime then use whatever gets the job done, just curious if there is a more updated or "proper" way of generating directories, maybe thru the use of the WINAPI or something.
1 2 3 4 5 6 7 8 9 10 11
#include <direct.h>
int main()
{
for(int i = 0; i < 10; i++)
{
_mkdir("C:\\testfolder");
}
return(0);
}