updated get_char to fill buffer and ad null terminator