title: How to get file size in ANSI C without fseek and ftell?
body: <p>While looking for ways to find the size of a file given a <code>FILE*</code>, I came across <a href="https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek%28%29+and+ftell%28%29+to+compute+the+size+of+a+file" rel="noreferrer">this article</a> advising against it. Instead, it seems to encourage using file descriptors and <code>fstat</code>.</p>
  
  <p>However I was under the impression that <code>fstat</code>, <code>open</code> and file descriptors in general are not as portable (After a bit of searching, I've found something to this <a href="http://www.aquaphoenix.com/ref/gnu_c_library/libc_68.html" rel="noreferrer">effect</a>).</p>
  
  <p>Is there a way to get the size of a file in ANSI C while keeping in line with the warnings in the article?</p>