本文整理汇总了C++中std::filesystem::path::wstring方法的典型用法代码示例。如果您正苦于以下问题:C++ path::wstring方法的具体用法?C++ path::wstring怎么用?C++ path::wstring使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::filesystem::path
的用法示例。
在下文中一共展示了path::wstring方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writePipe
bool writePipe(const std::filesystem::path &pipe, const std::wstring &data, bool wait)
{
HANDLE hPipe = CreateFile(pipe.wstring().c_str(), GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0,
nullptr);
if (hPipe != INVALID_HANDLE_VALUE) {
DWORD written;
const DWORD toWrite = static_cast<DWORD>(data.size() * sizeof(wchar_t));
WriteFile(hPipe, data.c_str(), toWrite, &written, nullptr);
const bool success = written == toWrite;
tLog << (success ? L"Wrote: " : L"Failed to write: ") << data << " to " << pipe;
WriteFile(hPipe, nullptr, sizeof(wchar_t), &written, nullptr);
CloseHandle(hPipe);
return success;
} else if (wait) {
// wait and retry
Sleep(20000);
return writePipe(pipe, data);
}
tLog << L"Failed to open pipe: " << pipe << L" data: " << data;
return false;
}
示例2: startProcess
bool startProcess(const std::filesystem::path &app)
{
STARTUPINFO info = {};
info.cb = sizeof(info);
PROCESS_INFORMATION pInfo = {};
const auto application = app.wstring();
if (!CreateProcess(const_cast<wchar_t *>(application.c_str()),
const_cast<wchar_t *>(application.c_str()), nullptr, nullptr, false,
DETACHED_PROCESS | INHERIT_PARENT_AFFINITY | CREATE_NO_WINDOW, nullptr,
nullptr, &info, &pInfo)) {
tLog << L"Failed to start: " << app;
return false;
}
WaitForInputIdle(pInfo.hProcess, INFINITE);
DWORD status;
GetExitCodeProcess(pInfo.hProcess, &status);
CloseHandle(pInfo.hProcess);
CloseHandle(pInfo.hThread);
tLog << L"Started: " << app << L" Status: "
<< (status == STILL_ACTIVE ? L"STILL_ACTIVE" : std::to_wstring(status));
return status == STILL_ACTIVE;
}
示例3: LoadSkinFontImage
void BitmapFont::LoadSkinFontImage(std::filesystem::path Location, Vec2 _CharSize, Vec2 _CellSize, Vec2 _RenderSize, char FontStart)
{
LoadFontImage(GameState::GetInstance().GetSkinFile(Utility::Narrow(Location.wstring())),
_CharSize, _CellSize, _RenderSize, FontStart);
}