I don't understand these magic. If you want some static buffer, then allocate it on the stack. But you actually want some return, thus you should just use static buffer of some fixed size. `getline` function seems to be the most appropriate in this case since it allocates buffer internally, avoiding thus further problems with partial input. I'd suggest to use it here.