MCPcopy Create free account
hub / github.com/boostorg/asio / read_input

Function read_input

example/cpp20/operations/c_callback_wrapper.cpp:21–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19// plus void* context idiom for exposing a callback.
20
21void read_input(const char* prompt, void (*cb)(void*, const char*), void* arg)
22{
23 std::thread(
24 [prompt = std::string(prompt), cb, arg]
25 {
26 std::cout << prompt << ": ";
27 std::cout.flush();
28 std::string line;
29 std::getline(std::cin, line);
30 cb(arg, line.c_str());
31 }).detach();
32}
33
34//------------------------------------------------------------------------------
35

Callers 1

async_read_inputFunction · 0.70

Calls 3

stringFunction · 0.85
detachMethod · 0.80
flushMethod · 0.80

Tested by

no test coverage detected