I need to make a function that creates a directory in a subdirectory of the current location. Here is what I've tried:
#include <iostream>
#include <cstring>
#include <dir.h>
#include <stdlib.h>
using namespace std;
void create(){
char nume[50];
int directory1,directory2;
directory1=mkdir("folder1");
directory2=mkdir("/folder1/ name1");
}
int main()
{
create();
}
When I run this code, the "folder1" directory does get created, but "name1" doesn't. What am I doing wrong? I also tried doing this:
#include <iostream>
#include <cstring>
#include <dir.h>
#include <stdlib.h>
using namespace std;
void create(){
char nume[50];
system("mkdir folder1");
system("mkdir /folder1/name1");
}
int main()
{
create();
}
But I get a "The syntax of the command is incorrect" message.