title: C++ - Copying a file to all sub directories
body: <p>I'm trying to create a program for educative purposes which should be able to copy one file (of any extension, the name of the file never changes) inside the same directory of the <code>.exe</code> to all the directories inside the main directory.
  Thus for example I have:</p>
  
  <ul>
  <li>Main_Directory</li>
  <li>Program.exe</li>
  <li>file.something</li>
  <li>Directory1</li>
  <li>Directory2</li>
  <li>Directory3</li>
  </ul>
  
  <p>In that situation, the program should copy file.something into directory1, 2 and 3.
  Through the use of this code I have access to the absolute path of the <code>.exe</code>'s folder:</p>
  
  <pre><code>char basePath[255]="";
  _fullpath(basePath,argv[0],sizeof(basePath));
  </code></pre>
  
  <p>Ideally, to solve the problem, two function could be made:</p>
  
  <p>First function:</p>
  
  <pre><code>Input:
  (char[]) The .exe's folder if necessary
  Output:
  (int) Number of folders inside the .exe's folder.
  </code></pre>
  
  <p>Second function:</p>
  
  <pre><code>input:
  (int) which folder to pick
  (int) total number of folders
  (char[]) the .exe's folder if necessary
  Output:
  (char[]) the name of the folder
  </code></pre>
  
  <p>With those two functions (which should return an array of chars instead of a string as I was forced to use those arrays to make the code work) I'd be able to make a simple loop, changing the destination's folder every time and copying the file to it.</p>
  
  <p>Of course it's just how the problem could be fixed, if a better solution exists, so be it.</p>
  
  <p>One last thing: I'd be really happy if you could add what each block or command does as I'm still learning c++ and I'm currently a beginner.</p>