• 0

C - Problem with the cursors keys


Question

Hi everyone, i have a problem with the cursors key, imagine you're typing something but you want to chage a character, you need to go back and change that character, but when i press the left cursor it appears a strange symbols, i'm asking if someone can help me please, i'm using the following code for a Escape Sequence and want to do that (if possible) in the same function:

int lerstring(char *s, int max)
{
	char ch;
	char *p = s;
  
	while ((ch = getch()) != 27 && s - p < max)
	{
  if(ch == '\n' || ch == '\r')  break;
  *s++ = ch;
  putchar (ch); /* to show what we are writing */
	}
	*s = 0;

	if(ch == 27)
	{
  *p = 0;
  return 0;
	}
	else
  return 1;
}

UltraMAX

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.