|
-
February 2nd, 2007, 04:11 PM
#1
conversion from int to char
Hi,
I am trying to write to a binary file and while I am setting the values I have to convert an int to a char using
rec.cStopReason = (char) m_nStopCode; where the defnitions are as follows.
char cStopReason; //25
int m_nStopCode;
For all the values in m_nstopcode it works fine but when I have the value as 128 in m_nstopcode I get cStopReason as -128.
Can anyone help me understand why it is doing that.
Thanks,
Pushpa.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|