Using Visual Studio 2008 C++, how can I create a folder using code. For some reason, a simple CreateDirectory isn't working.
A:
Are you by any chance trying to create a folder in your Visual Studio solution? If so, you could use code to do that, but you still have to right click the solution and add existing items.
Gabriel
2010-09-10 17:04:45
Hmm, it's a Win32 Console Application (Empty Project---no precompiled header). I add a .cpp file, and write the code there. What include files should I use?
bob packer
2010-09-10 17:09:08
You need to `#include <Windows.h>`
DeadMG
2010-09-10 17:13:20
A:
All I'm trying to do is create a folder. Nothing special. This code won't work.
#include <Windows.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
CreateDirectory("c:\\dirn.txt");
}
It gives this error:
error C2660: 'CreateDirectoryW' : function does not take 1 arguments
bob packer
2010-09-10 18:01:31