title: Under what circumstances will fseek/ftell or fstat fail to get the size of a file?
body: <p>I'm trying to access a file as a char array, via memory mapping it, or copying it into a buffer or whatever, but both of these need the size of the file, easy enough, thought I, just use fseek(file, 0, SEEK_END).</p>
  
  <p>However: according to <a href="http://www.cplusplus.com/reference/cstdio/fseek/" rel="nofollow noreferrer">C++ Reference</a> "Library implementations [of fseek] are allowed to not meaningfully support SEEK_END," Meaning that I can't get the size of a file using that method.</p>
  
  <p>Next I tried fstat, which is less portable, but at least will provide a compile error rather than a runtime problem; but <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/fstat.html" rel="nofollow noreferrer">The Open Group</a> notes that fstat does not need to provide a meaningful value for st_size.</p>
  
  <p>So: has anyone actually come across a system where these methods do not work?</p>