Getting limited user input, with echo
c++ isn't really my language, but I believe this would be an identical loop:

for(int i = 0; i &lt; 15; i++)
{
  char npt = _getch(); // Get input

  if(npt == '\r')
    break;
  else if(npt == '\b')
  {
    if(!name.empty())
      name.erase(std::prev(name.end()));
    if(i &gt;= 1)
      i -= 2;
    else
      i--;
  }
  else if(i == 14)
    i--;
  else            
    name += npt; // add input to string

  SetConsoleCursorPosition(hOut, cDraw);
  printf("              ");
  SetConsoleCursorPosition(hOut, cDraw);
  std::cout &lt;&lt; name;
}


The only difference between your first if and the else is the final else line, so I moved the conditional to the end to avoid repeating the same logic.

Additionally, I assume there's some way you could pad name with blank spaces so that you only have to call SetConsoleCursorPosition and print once per iteration.