Thanks for the advice.
This is what works now which takes into consideration any backspaces.
Code:
char cChar[2];
int c;
int extended = 0;
c = _getch();
if (c == 224) // extended character pressed on first time. i.e. arrow keys
extended = _getch();
if (extended) // special keys
{
// exit this function and perform special actions
}
while (c != '\r') // until the enter button is pressed
{
if (strlen(input) == 71)// to limit the string length to prevent overflow to output string
c = '\b';
if (c == 224) // detects extended character input during regular input
c = _getch(); // to ignore the extended key. i.e. arrow keys
if (c == '\b') // backspace pressed
{
if (strlen(input) != 0) // string is not empty
{
input[strlen(input) - 1] = '\0'; // erase the last character in the string
printf("%c %c", c, c); // erase the character on the screen
}
}
else // if the character is viewable. i.e. not backspaces
{
printf("%c", c);
sprintf(cChar, "%c", c);
strcat(input, cChar);
}
c = _getch();
}