Problem with enum and files

This is a discussion on Problem with enum and files within the C++ Programming forums, part of the General Programming Boards category; Hi there, I'm having a problem that's probably pretty easy to fix. I am trying to get information from a ...

  1. #1
    Master At Novice
    Join Date
    Oct 2005
    Location
    Cardassia & Canada, eh!
    Posts
    31

    Problem with enum and files

    Hi there, I'm having a problem that's probably pretty easy to fix.

    I am trying to get information from a directoryInfoBox, post that as working directory, then create a directory from a textBox and move all the files into it.
    The thing is, it will only create the directory, I don't think it's reading any files at all,
    Here's the code, if you need more of it I'll post more:

    Code:
    private: System::Void button1_Click(System::Object *  sender, System::EventArgs *  e)
    		 {
    		//To String Button
    //---------
    //Goal:
    //Create Dir:	Dialog Selected\TextBox1 Text
    //Then,
    //Move:			Files_In_Enumerator To Dialog Selected\TextBox1 Text
    //---------
    //Path:			Selected Path
    //Path2:		Selected Path\TextBox1 Text
    //Di:			Create Directory: "Path2"
    //Movepath:		Dialog Selected\TextBox1 Text\
    //---------
    			System::String* path1 = folderBrowserDialog1->SelectedPath;
    			System::String* path2 = String::Concat(path1, S"\\", textBox1->Text);
    			DirectoryInfo* di = Directory::CreateDirectory(path2);
    			DirectoryInfo* dui = new DirectoryInfo (path2);
    			FileInfo* fi[] = dui->GetFiles();
    			
    			Collections::IEnumerator* myEnum = fi->GetEnumerator();
    			int i=0;
    			while (myEnum->MoveNext()) 
    			{
    				FileInfo* fiTemp = __try_cast<FileInfo*>(myEnum->Current);
    				File::Move(myEnum->Current->ToString(), path2);
    			i++;
    			}
    
    
    		 }
    Any help is greatly appreciated!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,556

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. which command can be used instead of enum for long integers?
    By aarti_gehani in forum C Programming
    Replies: 3
    Last Post: 03-03-2009, 03:05 AM
  2. Conflicting enum issue
    By 7force in forum C Programming
    Replies: 1
    Last Post: 07-05-2006, 03:51 AM
  3. Enum or Const Ints?
    By Syneris in forum C++ Programming
    Replies: 5
    Last Post: 01-20-2006, 03:58 AM
  4. Problems with Enum and Files
    By Robert_Sitter in forum Windows Programming
    Replies: 7
    Last Post: 11-25-2005, 03:31 PM
  5. SHELL – Path problem 2
    By geek@02 in forum Windows Programming
    Replies: 1
    Last Post: 04-29-2004, 10:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21