Insert Integer in char array to use it in rename function
<p>it´s long ago since i tried to code sth. but i´m looking for a simple way of iterating through some folders to rename the containing files.</p>

<p>i have folder which look like 'MORE0001', 'MORE0002' etc. They contain all one file with the same name 'Data'</p>

<p>What i want to do is to rename all containing files to 'data.dat' (and maybe to find a way to extract the files out of the folders..)</p>

<p>so this is what it looks like:</p>

<pre><code>   for (int i=0; i&lt;10;i++){

   char oldname[]= "directory/MORE0001/data";
   char newname[]= "directory/MORE0001/data.dat";

   rename(oldname,newname);

   }
</code></pre>

<p>this works pretty fine, but i want to change the <code>0001</code> within the for-loop to <code>0002</code>etc..</p>

<p>hope you guys can help me.. i did not find an answer yet to this simple question</p>