当前位置: 首页>>代码示例>>C++>>正文


C++ path::wstring方法代码示例

本文整理汇总了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;
}
开发者ID:KDE,项目名称:snoretoast,代码行数:21,代码来源:utils.cpp

示例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;
}
开发者ID:KDE,项目名称:snoretoast,代码行数:22,代码来源:utils.cpp

示例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);
}
开发者ID:alexanderkunz,项目名称:raindrop,代码行数:5,代码来源:BitmapFont.cpp


注:本文中的std::filesystem::path::wstring方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。