I'm to convert an std::ifstream into a FILE* handle in Windows. I googled a lot about this problem and people say that it is possible to get the underlying file descriptor of the fstream with the function fstream::fd(). The problem is that in Visual Studio there's no way to make it work (it says that the class has no member fd). In which library can I find this function? I included the usual C++ fstream.
#include <fstream>
FILE* handle;
std::ifstream file;
file.open(file_to_open);
if (file.is_open()) {
std::ifstream f;
handle = f.fd();
file.close();
}
EDIT: If there's another function in Windows that allows to open a file without calling internally CreateFileA function, it would be appreciated.