Boost C++ Libraries: Ticket #4610: filesystem::file_size problem on Windows platform https://svn.boost.org/trac10/ticket/4610 <p> This is a subtle problem on Windows platform. </p> <p> I see that file_size calls <a class="missing wiki">GetFileAttributesEx</a> to obtain file size - that works in a chance of 99.99%. </p> <p> What is the other 0.01%? It's like this - <a class="missing wiki">GetFileAttributes</a>(Ex) does not work with system files, say c:\pagefile.sys. It will only return FALSE and <a class="missing wiki">GetLastError</a> returns 32 (The process cannot access the file because it is being used by another process. ) </p> <p> Instead, you have to call <a class="missing wiki">FindFirstFile</a> which correctly reports file status in all cases. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4610 Trac 1.4.3 Beman Dawes Wed, 31 Dec 2014 13:53:29 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4610#comment:1 https://svn.boost.org/trac10/ticket/4610#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> I don't find the system files use case compelling enough to make a change. I'm worried that <a class="missing wiki">FindFirstFile</a> may have its own set of problems, such as impacting performance in large directories where the file does not exist. The motivation is too weak to invest the time to test the implications of such a change. </p> <p> Thanks for your interest in Boost.Filesystem, </p> <p> --Beman </p> Ticket