top | item 29780237

(no title)

throwaway525142 | 4 years ago

Reading byte-by-byte using `getchar()` is probably quite slow.

discuss

order

enriquto|4 years ago

No, it isn't, really. It's internally buffered. Most calls to getchar do not read anything, they just return a pointer to the next character in an already read buffer.

lelanthran|4 years ago

> No, it isn't, really. It's internally buffered. Most calls to getchar do not read anything, they just return a pointer to the next character in an already read buffer.

Not only that, it's permissible for getchar() to be implemented as a macro, so you might even avoid an actual function call too.

OskarS|4 years ago

getch() is buffered, the performance is fine.