本文介绍了在Windows下使用非MSVC编译器打开带有Unicode文件名的文件的fstream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当文件名是Unicode文件名时,我需要将文件打开为std :: fstream(或其他任何std :: ostream)。



MSVC我有非标准扩展 std :: fstream :: open(wchar_t const *,...)?我可以用其他编译器,如GCC(最重要的)和可能的Borland编译器。



我知道CRTL提供 _wfopen 但是它给出C FILE * 接口而不是io流,也许有一个非标准的方法来创建io流从 FILE * ?是否有任何 boost :: ifstream 与MSVC像Windows扩展?

解决方案

p>

您需要创建自己的流缓冲区,使用 _wfopen 罩。您可以使用例如 boost :: iostream


I need to open a file as std::fstream (or actually any other std::ostream) when file name is "Unicode" file name.

Under MSVC I have non-standard extension std::fstream::open(wchar_t const *,...)? What can I do with other compilers like GCC (most important) and probably Borland compiler.

I know that CRTL provides _wfopen but it gives C FILE * interface instead of io-streams, maybe there is a non-standard way to create io-stream from FILE *? Is there any boost::ifstream with MSVC like extension for Windows?

解决方案

Currently there is no easy solution.

You need to create your own stream buffer that uses _wfopen under the hood. You can use for this for example boost::iostream

这篇关于在Windows下使用非MSVC编译器打开带有Unicode文件名的文件的fstream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 13:02