![]() |
|
Help Folders - Printable Version +- ItsMods (https://www.itsmods.com) +-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html) +--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html) +--- Thread: Help Folders (/Thread-Help-Folders.html) |
Folders - aosma8 - 02-24-2011 Hey guys, im still a beginner and was wondering how I could create a program that creates an amount of files that the user inputs then creates the files at a directory that the user has chosen I have successfully created a folder in the project folder but thats about it. Thanks. Found this and tried it on a win32 app but it didnt work Code: #using <mscorlib.dll>
using namespace System;
using namespace System::IO;
int main() {
// Specify the directory you want to manipulate.
String* path = S"c:\\Users\\Faizal";
try {
// Determine whether the directory exists.
if (Directory::Exists(path)) {
Console::WriteLine(S"That path exists already.");
return 0;
}
// Try to create the directory.
DirectoryInfo* di = Directory::CreateDirectory(path);
Console::WriteLine(S"The directory was created successfully at {0}.",
__box(Directory::GetCreationTime(path)));
// Delete the directory.
di->Delete();
Console::WriteLine(S"The directory was deleted successfully.");
} catch (Exception* e) {
Console::WriteLine(S"The process failed: {0}", e);
}
}RE: Folders - gellin - 07-03-2011 1st allow me to say that the language you are using is a dead language, MC++ was superseeded by C++/CLI over 5 years ago. I wouldn't even touch MC++ with your dick. Please read here - http://en.wikipedia.org/wiki/C%2B%2B/CLI now that you are using the right language you would want to do something like this, Code: array<String^>^ Locations = gcnew array<String^>{ "C:\\1", "C:\\2", "C:\\3" };
for each( String^ s in Locations )
{
if( !Directory::Exists( s ) )
{
//Do Stuff
}
} |