Answer the question
In order to leave comments, you need to log in
What is the problem with wofstream in linux?
In general, I decided to build a module for CentOS 9, but stumbled on the code
bool forceinline ForceWriteToFile(
/* filepath. */ const std::wstring & filename,
/* content body. */ const std::wstring & body)
{
#ifdef __Windows__
std::wofstream out(filename, std::ios::binary);
#else
std::ofstream out(Machinarium::Utils::String::ToStdString(filename), std::ios::binary);
#endif
if (out.fail()) {
std::string a(filename.begin(), filename.end());
#ifdef Machinarium_Debug
std::wcout << L"Failed to write to " << filename << L", FORCED unlinking." << std::endl;
#endif
unlink(a.c_str());
#ifdef __Windows__
out.open(filename);
#else
out.open(Machinarium::Utils::String::ToStdString(filename));
#endif
if (out.fail()) return false;
}
#ifdef __Windows__
out << body;
#else
out << Machinarium::Utils::String::ToStdString(body);
#endif
return true;
}
../src/Machinarium/Filesystem/FilesystemObject.cpp:106:86: ошибка: no matching function for call to «std::basic_ofstream<wchar_t>::basic_ofstream(std::wstring, std::_Ios_Openmode)»
106 | std::wofstream input(_path.wstring(), std::ofstream::out | std::ofstream::app);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question