in the following code:
if the path doesnt exist what should i do to the program create it?Code:ofstream a_file("C:\\Documents and Setings\\Desktop\\Data")
This is a discussion on Creating a new directory within the C++ Programming forums, part of the General Programming Boards category; in the following code: Code: ofstream a_file("C:\Documents and Setings\Desktop\Data") if the path doesnt exist what should i do to the ...
in the following code:
if the path doesnt exist what should i do to the program create it?Code:ofstream a_file("C:\\Documents and Setings\\Desktop\\Data")
Fix the spelling?Originally Posted by Scarvenger
"C:\\Documents and Settings\\Desktop\\Data"
call win32 api CreateDirectory(), or mkdir(), or SHCreateDirectoryEx(). see MSDN for description of all these functions.
If your system is POSIX compliant then you can use mkdir() if it isn't just take the shortcut like I do:
When in doubt... use system().Code:#include <cstdlib> std::system("mkdir \"some folder\"");
Use this:
Code:#include <windows.h> //need this header void main() { CreateDirectory("Path name", NULL); }
Hello, testing testing. Everthing is running perfectly...for now