Create Directories in a for-loop (recursively)

Hi everybody,

I'm creating a program with Microsoft Visual Studio 2010, it's a console program. My computer is running on XP.

In the program I'm creating I would like add a for-loop which will create 5 directories. The index of the loop will be used to create the path of each directory.

I tried this following code:
1
2
3
4
5
6
for (index=0,index<5,index++)
{
char path[128]
sprinf(path,"C:\\Documents and Settings\\Analysis\\Cam%d",index+1);
CreateDirectory(path);
}


But it's doesn't work... The error is about the argument of CreateDirectory().
' Error: argument of type "const char*" is incompatible with parameter of type "LPCWSTR" '.

I tried to convert a char in LPCWSTR.
I tried to create the path direclty in LPCWSTR.
I saw the MSDN about the CreateDirectory function, but that didn't help me.
I tried the mkdir function but I think it's an linux function.
But nothing worked.

So if you know how to fix it or an other way, please help me.

Thanks, and sorry for the mistakes my english is not really good.
Topic archived. No new replies allowed.