如何获得c++ iostream的FileHandle ?
How do I get the FileHandle for a C++ iostream?
我需要与Windows上使用mingw的c++ iostream相关联的Windows FileHandle。这可能与Windows上与c++ iostream关联的UNIX文件描述符相同。有人知道怎么找吗?谢谢。
你看到我的答案了吗?
我如何在win32上刷新stdlib输出文件?
std::basic_filebuf<char> *file_buf = dynamic_cast<std::basic_filebuf<char> *>(f.rdbuf());
if (file_buf != 0) {
struct to_get_protected_member : public std::basic_filebuf<char> {
int fd() { return _M_file.fd(); }
};
printf("your fd is %dn", static_cast<to_get_protected_member *>(file_buf)->fd());
}
相关文章:
- 是否可以用"iostream"包装现有的TCP/OOpenSSL会话
- 需要从 istream 和 ostream 派生 iostream
- std::带有自定义缓冲区的 iostream 不允许我写入
- 新的放置取决于 iostream
- 包含在 <initializer_list> <iostream>?
- 为什么在包含iostream时可以使用printf()?
- 如果 iostream 对象不可复制,为什么以下代码是合法的?
- 为什么我必须在包含后写 std::cin <iostream>?
- 如何将带有空字符的字节数组馈送到 std::iostream 中?
- 磁力计代码:C++ vs C - iosstream,矢量 - 错误iostream:没有这样的文件或目录
- 通过boost asio iostream下载大文件的最快方法是什么?
- 为什么 VScode 在 .h 文件中显示"'iostream' file not found"?
- 包含iostream导致不同的二进制文件
- iostream运算符重载的C++异常规范
- basic_iostream和iostream之间的区别
- iostream 和 fstream 的重载<<
- Borland C++编译器中的Iostream
- 从类模板继承时需要iostream
- 为什么<iostream>依赖MinGW dll?
- 如何获得c++ iostream的FileHandle ?