• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Folders
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.


Found this and tried it on a win32 app but it didnt work

#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}.",

        // Delete the directory.
        Console::WriteLine(S"The directory was deleted successfully.");
    } catch (Exception* e) {
        Console::WriteLine(S"The process failed: {0}", e);
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,

array<String^>^ Locations = gcnew array<String^>{ "C:\\1", "C:\\2", "C:\\3" };

for each( String^ s in Locations )
      if( !Directory::Exists( s ) )
            //Do Stuff


Forum Jump:

Users browsing this thread: 1 Guest(s)