Performance of fopen vs stat

Posted by Alex Marshall on Stack Overflow See other posts from Stack Overflow or by Alex Marshall
Published on 2010-04-15T16:36:55Z Indexed on 2010/04/15 16:53 UTC
Read the original article Hit count: 310

Filed under:
|
|

Hello,

I'm writing several C programs for an embedded system where every bit of performance we can squeeze out will matter. Part of that is accessing log files. When determining if a file exists, is there any performance difference between using open / fopen, and stat ? I've been using stat on the assumption that it only has to do a quick check against the file system, whereas fopen would have to actually gain access to a file and manipulate internal data structures before returning. Is there any merit to this ?

© Stack Overflow or respective owner

Related posts about c

    Related posts about file-io