Page 1 of 1

Code keeps locking up

Posted: Wed Feb 12, 2003 12:00 am
by netster403
I've gotten my interrupts(software+hardware)+exc.'s working. and my k_printf + getch + keytable + putc + strings working.

but this is where my os freezes....


< CODE BELOW >

void getstring(char *buffer, unsigned int color)
{
     char string[256];
     char ascii_key = '\0';
     int i=0;

     unsigned int startpos = charpos;

     while(ascii_key != '\n')
     {
          ascii_key = getch();

          if(ascii_key != '\n')
          {
               if(ascii_key == '\0')
               {
                    // do nothing
               } else {
                    if(ascii_key == '\b')
                    {
                         if(charpos > startpos)
                         {
                              putc(ascii_key, color); // putc handles the backspace

                              string[--i]='\0';
                              i--;
                         }
                    } else {
                         putc(ascii_key, color);
                         string[i] = ascii_key;
                    }
               }
          } else {
               string[i] = '\0';
          }
          i++;
     }

     strcpy(buffer, string);
}

< END CODE >



any ideas? i really need help on this one.

RE:Code keeps locking up

Posted: Sat Feb 15, 2003 12:00 am
by netster403
bump, because im cool like that.