Skip to content

Instantly share code, notes, and snippets.

@willir
Last active August 29, 2015 14:22
Show Gist options
  • Save willir/3c2e40b043caf124db6c to your computer and use it in GitHub Desktop.
Save willir/3c2e40b043caf124db6c to your computer and use it in GitHub Desktop.
Some C++ Short Notes
//libevent and stdin:
#include <unistd.h> //STDIN_FILENO
{
auto eventStdIn = event_new(eventBase.get(), STDIN_FILENO, EV_READ|EV_PERSIST, onStdIn, eventBase.get());
event_add(eventStdIn, nullptr);
}
onStdIn(evutil_socket_t sock, short, void *pVoid) {
ssize_t len = read(sock, buf, 1023);
}
//****************************************************************************************************
//Print vector:
std::copy(results.begin(), results.end(),
std::ostream_iterator<float>(cout, " "));
//****************************************************************************************************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment