Passing string through stat() function
<p>I have following code:</p>

<pre><code>#include &lt;stdio.h&gt;       // For printf()
#include &lt;sys/stat.h&gt;   // For struct stat and stat()

struct stat stResult;

if(stat("Filename.txt", &amp;stResult) == 0)
{
      // We have File Attributes
      // stResult.st_size is the size in bytes (I believe)
      // It also contains some other information you can lookup if you feel like it
printf("Filesize: %i", stResult.st_size);
}
else
{
      // We couldn't open the file
printf("Couldn't get file attributes...");
}
</code></pre>

<p>Now. How can I pass my own string through stat()? Like this</p>

<pre><code>string myStr = "MyFile.txt";
stat(myStr, &amp;stResult)
</code></pre>
