The part about the filesystem is completely ironic, because the C++ version of the same API uses no pointers at all.
Files are garbage collected. There is no use after free if someone deletes your file because the OS sees that you are still using it
- on Windows, another process deleting the file is prevented (unless you explicitly opted-in to cooperative FILE_SHARE_DELETE); and
- on Linux, another process deleting the file only unlinks its name, and your handle continues working with the nameless file and its content