Last active
August 29, 2015 14:22
-
-
Save willir/3c2e40b043caf124db6c to your computer and use it in GitHub Desktop.
Some C++ Short Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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