MCPcopy Create free account
hub / github.com/arun11299/cpp-subprocess / get_last_error

Function get_last_error

cpp-subprocess/subprocess.hpp:367–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365 }
366
367 inline std::string get_last_error(DWORD errorMessageID)
368 {
369 if (errorMessageID == 0)
370 return std::string();
371
372 LPSTR messageBuffer = nullptr;
373 size_t size = FormatMessageA(
374 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
375 FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK,
376 NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
377 (LPSTR)&messageBuffer, 0, NULL);
378
379 std::string message(messageBuffer, size);
380
381 LocalFree(messageBuffer);
382
383 return message;
384 }
385
386 inline FILE *file_from_handle(HANDLE h, const char *mode)
387 {

Callers 1

execute_processMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected