C++ e MinGW实现使用的是相同的Windows文件实现,您应该尝试这些解决方法之一。我实际上使用的是MinGW,但这是一个有趣的分析。@MrM21632如果您在使用您接受的答案(您确实对此进行了注释)后仍出现错误,然后,也许MinGW实现使用了相同的Win

C++ e MinGW实现使用的是相同的Windows文件实现,您应该尝试这些解决方法之一。我实际上使用的是MinGW,但这是一个有趣的分析。@MrM21632如果您在使用您接受的答案(您确实对此进行了注释)后仍出现错误,然后,也许MinGW实现使用了相同的Win,c++,wstring,wchar,C++,Wstring,Wchar,e MinGW实现使用的是相同的Windows文件实现,您应该尝试这些解决方法之一。我实际上使用的是MinGW,但这是一个有趣的分析。@MrM21632如果您在使用您接受的答案(您确实对此进行了注释)后仍出现错误,然后,也许MinGW实现使用了相同的Windows文件实现,您应该尝试这些解决方法之一。 #include <iostream> #include <fstream> #include <string> #include <vector>


e MinGW实现使用的是相同的Windows文件实现,您应该尝试这些解决方法之一。我实际上使用的是MinGW,但这是一个有趣的分析。@MrM21632如果您在使用您接受的答案(您确实对此进行了注释)后仍出现错误,然后,也许MinGW实现使用了相同的Windows文件实现,您应该尝试这些解决方法之一。
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <cstdlib>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/random_device.hpp>
#include <boost/random/uniform_int_distribution.hpp>


int main(int argc, char* argv[]) {
    if (argc != 2) {
        std::cout << "Usage: word [lang]" << std::endl;
        std::cout << "\tlang: Choose from de,en,es,fr,gr,it,la,ru" << std::endl;
        return EXIT_FAILURE;
    }

    std::string file = static_cast<std::string>("C:\\util_bin\\data\\words_") + static_cast<std::string>(argv[1]) + static_cast<std::string>(".txt");
    std::wfstream fin(file, std::wifstream::in);

    std::vector<std::wstring> data;
    std::wstring line;
    while (std::getline(fin, line))
        data.push_back(line);
    int size = data.size();

    boost::random::random_device rd;
    boost::random::mt19937 mt(rd());
    boost::random::uniform_int_distribution<int> dist(0, size - 1);

    std::wcout << data[dist(mt)] << std::endl;
}
C:\util_bin>word ru
������������

C:\util_bin>
fin.imbue( std::locale(std::locale::empty(), new std::codecvt_utf8<wchar_t>) );