Re: [cc65] cc65/C questions

From: Bryan Pope <bpope1wordstock.com>
Date: 2006-09-08 14:57:04
And thusly were the wise words spake by Tom Watt
> 
> 2. I'm using the following function to get text at a prompt.  It works fine
> except if you backspace too much the cursor keeps going and will go up to
> the next line.  Is there an easy way to fix that?
> 
>  
> 
> char* getline(void)
> 
> {
> 
>             static char linetext[40];
> 
>             unsigned len;
> 
>             fgets(linetext, sizeof(linetext), stdin);
> 
>             len = strlen(linetext);
> 
>             if (len >= 1 && linetext[len - 1] == '\n') linetext[len - 1] =
> '\0';
> 
>             return linetext;
> 
> }
> 

	I would use getch () in a loop instead, then you could test 
what is returned and not backspace when there are no characters to 
delete.  

Cheers,

Bryan

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Sep 8 14:57:14 2006

This archive was generated by hypermail 2.1.8 : 2006-09-08 14:57:17 CEST