I need to read input from standard input until a space or a TAB is pressed.
Eventually, I need to hold the input in a std::string
object.
I need to read input from standard input until a space or a TAB is pressed.
Eventually, I need to hold the input in a std::string
object.
You can use
getch()
orgetchar()
to read each character separately, and then process the input manually so that when a space or a tab is pressed, you end the input.This should do the job: