This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

scanf receives 0x0A instead of 0x0D

Hello to everyone,
some incredibile detail about scanf (CARM)

    unsigned char my_key;
    my_key=0;
    scanf("%c",&my_key);


When the PC sends a chr$(13) = CR the microcontroller receives a 0x0A = LF.
I had my PC under suspicion to attach an additional LF.
But now i'am using the int14h and controlled with an oszilloscope, there is no additional LF. So how to correct the scanf?

Parents
  • Just a question: Exactly _why_ are you using scanf. On a standard - non-embedded - machine, scanf is among the most common targets for buffer-overflow attacks.

    Are the sending side using an existing protocol, or are you creating something specifically for this project?

Reply
  • Just a question: Exactly _why_ are you using scanf. On a standard - non-embedded - machine, scanf is among the most common targets for buffer-overflow attacks.

    Are the sending side using an existing protocol, or are you creating something specifically for this project?

Children
No data