0

I am looking for a simple solution to open a file, probably using CreateFile and being sure that nobody can read/write to it and still being able to obtain a std::iostream object, which is needed later.

4

1 回答 1

1

我认为您可以执行以下操作:

#include <iostream>
#include <fstream>

fstream my_stream;
my_stream.open("my.file", std::ios_base::in | std::ios_base::out, _SH_DENYRW);

my_stream << "test";
于 2013-10-07T17:16:47.080 回答