reading a directory in C++ in portable way
<p>I have a requirement as follows. I have a directory for eg i have /tmp/myFolder</p>

<p>Under "myFolder" i have files whose names as below</p>

<pre><code>myFile-N001.txt
myFile-N002.txt
myFile-N003.txt
</code></pre>

<p>in my application while writing to a file i should write to largest number file in /tmp/myFolder, for eg in above case i should write to myFile-N003.txt.</p>

<blockquote>
  <p>The above should be achieved in C++ and in portable way preferably in POSIX way.</p>
</blockquote>

<p>Can any one provide simple example on how we can achive this in C++.</p>

<p>Thanks</p>
