Very strange char array behaviour
<p>.</p>

<pre><code> unsigned int fname_length = 0;
//fname length equals 30
file.read((char*)&amp;fname_length,sizeof(unsigned int));
//fname contains random data as you would expect
char *fname = new char[fname_length];
//fname contains all the data 30 bytes long as you would expect, plus 18 bytes of      random data on the end (intellisense display)
file.read((char*)fname,fname_length);
//m_material_file (std:string) contains all 48 characters
m_material_file = fname;
// count = 48
int count = m_material_file.length();
</code></pre>

<p>now when trying this way, intellisense still shows the 18 bytes of data after setting the char array to all ' ' and I get exactly the same results. even without the file read</p>

<pre><code>char name[30];
for(int i = 0; i &lt; 30; ++i)
{
  name[i] = ' ';
}
file.read((char*)fname,30);
m_material_file = name; 
int count = m_material_file.length();
</code></pre>

<p>any idea whats going wrong here, its probably something completely obvious but im stumped!</p>

<p>thanks</p>
