We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, This is my program. int a = 0x0A; printf("%c",a); Why is it that the output from the serial port is 0x0D and 0x0A instead of just 0x0A itself? Thanks..
>>"0x0A is not a character. It is a code." >That's extremely misleading. >0x0A is the numeric represention (ASCII >code) You just stated that it is a code. ASCII code. I don't think it is "extremely misleading". Sure, an ASCII terminal represents the 0x0A as a Line feed or Carriage return. (Can't remember), but I don't think the user is that deep into the theory and is probably using it as an ascii character by the message. Regards,
"You just stated that it is a code. ASCII code." Yes, but so is 0x41. And that's an 'A'. It doesn't mean it isn't a character. "I don't think it is "extremely misleading"." Ok, totally wrong then. Every value in the range 0 to 127 is an ASCII character. "Sure, an ASCII terminal represents the 0x0A as a Line feed or Carriage return" Like I said, it's a linefeed. "but I don't think the user is that deep into the theory and is probably using it as an ascii character by the message" Yes, he is using it as an ASCII character. That's because it IS an ASCII character. But you've gone and told him it isn't. To be honest, I don't think that understanding what an ASCII character is is exactly being "deep into the theory". It's pretty fundamental stuff. Stefan