Francis

Francis

  • NA
  • 5
  • 0

compiler warning

May 4 2009 3:00 PM

I am writing a program that sends ascii text out the serial port to a simple display device.
The device talks 8-N-1 but we all know ascii only needs 7 bits for numbers and letters on the
first ASCII chart; so the display has a "value added" feature that if the eight bit is set high,
then that character is blinking. I know setting the eight bit will add 128 to the decimal
value of the character so this is the code I wrote:

char c_Letter;
char c_LetterBlinking;

c_LetterBlinking = (c_Letter + 128);

My question is: Although this does the job and I send the letters out the port; my MS Vis C++ 6.0 compiler gives me a warning on the equals sign telling me:
"converting from int to char, possible loss of data"
So, there must be a better way.....too bad the compiler can't just come out and show me how it thinks I should be writing code.


Answers (2)