Manfred Kabzinski

sscanf problem

Discussion created by Manfred Kabzinski on Jun 12, 2012
Latest reply on Jun 15, 2012 by Manfred Kabzinski

Hi,

 

i have a problem with using sscanf. I want to convert a hexdezimal ASCII Code to an integer. If i use it in main(), everything works, but if i put in in an event like AS1_OnRxChar() it does not work. Sometimes there are the wrong results, somtimes the program "hangs".

 

My code is like:

void  AS2_OnRxChar(void)
{
...
      char in[] = "CD";
      int i;   
...

      sscanf(in, "%x", &i);

...

}

The variable i should be 205, but it does not work!!!

Can sombody help me? What is my mistake?

Best Regards

 

freddyka

Outcomes