Code keeps locking up

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
netster403

Code keeps locking up

Post 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.
netster403

RE:Code keeps locking up

Post by netster403 »

bump, because im cool like that.
Post Reply