Hello. In my program, the user enters the name or nickname. I allocated for this an array of 15 characters and no more. If you use the getline function (str, 15), then it will cut the entered string to the desired size, but as long as the user types, he can type as many characters as possible. Please tell me how to make it so that after the 15th character, the characters in the console are no longer displayed and the user understands that it’s time to press Enter?

    1 answer 1

    On pure C ++ - no way. C ++ is written on the assumption that the user may not have either a screen or a keyboard, and therefore only supports streaming data entry. (Yes, I also think this is nonsense on the part of language architects.)

    You will have to use system-specific libraries. For Windows, this might just be WinAPI, for Linux platforms, the curses library is useful.