Skip to content

Instantly share code, notes, and snippets.

View autonomobil's full-sized avatar

Moritz Cremer autonomobil

View GitHub Profile
@PeteBlackerThe3rd
PeteBlackerThe3rd / getline_async.h
Last active May 6, 2023 23:53
drop in non-blocking replacement for std::getline
#include <iostream>
bool getline_async(std::istream& is, std::string& str, char delim = '\n') {
static std::string lineSoFar;
char inChar;
int charsRead = 0;
bool lineRead = false;
str = "";