the program receives an unknown amount of integers in stdin, and i need to parse them withouth hanging.
Unfortunately, stdin is a async. stream and blocks, if it doesnt find any integers left.
Is this supposed to be interactive input? If so, then the user can trigger EOF at the command prompt to get around the wait for more input, or you can just read the input as a string then parse the string. If not, i.e., of the input is being piped from elsewhere, then EOF will be reached anyway, so the wait for more input won't happen.
Originally Posted by tuli
I cant use peek() or seek() either, as both are async, too, (which makes me wonder what their exact use is?).
The input file may contain several such lines, so i split them by "\n" first, the process the individual lines, by parsing the header and then reading in the list of integers. So there is not end of file.
I solved this for now by using the extended string library of a FrameWork.
I`d still love to know what i can do in such a case, except for parsing the input char by char.