Why can't volatile FILE* be assigned to FILE*?
<p>I have a Visual C++ program that opens a file in one thread with <code>FILE* fp = fopen(...)</code>. I want that thread to block on an event object while another thread reads the file, then signals the blocked thread when it is done, which will then close the file. Because <code>fp</code> is shared between threads, I have declared it as <code>volatile FILE* fp</code>. However, <code>fread()</code> won't accept a volatile as its <code>FILE*</code> argument. I tried using a local pointer, with <code>FILE* fpLocal = fp;</code> in the thread that will call <code>fread()</code>, but that got me this: </p>

<pre><code> Error: a value of type "volatile FILE*" cannot be assigned to an entity of type "FILE*"
</code></pre>

<p>Naturally, this has me worried that maybe I'm making a mistake by trying to open a file in one thread and read it in another to begin with, though I don't see why (yet).</p>

<p>Can someone help me with this? Why can't I assign a <code>volatile FILE*</code> to a <code>FILE*</code>?</p>
