title: How to convert string to a FILE* opened for read
body: <p>I am writing a C++ application, which needs to call a library function that expects <code>FILE*</code> opened for read. I have no code of that function - it a black box to me.
  The data that I need to pass to the function is in memory in <code>char*</code> buffer of a known size. Ideally, I need to wrap a my buffer in a <code>FILE*</code> structure and pass it in, but I need all the stdio functions that normally works on a <code>FILE*</code> to work on what I pass in, for I don't know which of the functions it calls - definitely <code>fread</code>, possibly <code>fseek</code> too.
  The code is rather a performance-sensitive one, so I would like to avoid writing the buffer to disk just so that I could create a <code>FILE*</code> from it by <code>fopen</code>. Is there a way to make a <code>FILE*</code> that would allow from my buffer in memory? 
  Something like <code>stringstream</code> in c++?
  My code needs to be able to run both on windows and linux.</p>
  
  <p>I've seen quite a few questions where people try to write via <code>FILE*</code> to memory. My case is rather a reverse - I need to present the existing buffer as a <em>readable</em> <code>FILE*</code>.</p>
  
  <p>Thanks a lot!</p>
  
  <p>P.S. yes, <a href="https://stackoverflow.com/questions/11381694/using-a-c-string-like-a-file">Using a C string like a FILE*</a> is exactly what I'm asking, somehow I couldn't find it earlier...</p>
  
  <p>Still, if you could suggest a solution on windows, that would be very helpful!</p>