Discussion Board
Go to the previous messageGo to the following message
Current Forum: Homework 4 General Forum
Date: Tue Oct 2 2001 9:34 pm
Author: Lee, Peter <petel@cmu.edu>
Subject: Re: Binary data

Yes, what you say is true. When you cast a byte to an int, you will get a value in the range of -128 to 127. (If you don't understand why this happens or why this might be a sensible thing to do, wait until you take the 15-213 course. Otherwise, just take my word for it.)

The best thing to do, then, is to add 128 to the result of the cast. This will give you a value in the range of 0 to 255.
Post response

Go to the previous messageGo to the following message
Current Thread Detail:
Binary data +Attachment      Danish, Matt R.      Tue Oct 2 2001 8:35 pm       
Re: Binary data      Lee, Peter      Tue Oct 2 2001 9:34 pm       
Re: Binary data      Danish, Matt R.      Tue Oct 2 2001 10:34 pm       
Re: Binary data      Lee, Peter      Tue Oct 2 2001 10:38 pm       
Re: Binary data      Cipriani, Jason A.      Thu Oct 4 2001 10:26 am       

Back to previous screen