I want to use cin so that when the input is expected from the keyboard there is existing text which can be edited and then press enter to read that data.
Is there a standard c++ way of doing this?
The console output cannot be edited in a standard way. You could use the '\b' escape sequence to overwrite any existing characters. If you had:
"Enter your input"
then cout << "\b\b\b\b\b "; would make the output look like this:
"Enter your "
You can use getch() or GetAsyncKeyState or other ugly non-standard function to output "\b " each time backspace is pressed.
What would be the best way in Linux?