How can I override an C++ standard-library class function?

后端 未结 4 2073
长情又很酷
长情又很酷 2021-02-15 17:52

How can I override a C++ standard-library class function? In my application, I use ofstream objects in many different places of code. And now I want to open files i

4条回答
  •  孤街浪徒
    2021-02-15 18:46

    This is not answering your question directly as I wouldn't advise overriding ofstream::open.

    Instead couldn't you use the first suggestion in this post? Open the file as you normally would to get the correct permissions, and then construct an ofstream from the file descriptor.

提交回复
热议问题