title: Objective-c: Why is strtol method used in this code I inherited?
body: <p>I recently inherited some Objective-C code and am really confused as to what it's actually doing?  </p>
  
  <p>1) I don't understand why the <code>char byte_chars[3]</code> is being populated by a '0' first and then a 0 at the end?  </p>
  
  <p>2) I don't understand why they used <code>unsigned char</code> for the wholeByte, but the put a long into it?  </p>
  
  <p>3) Part of me is a little confused as to what the strtol method does here, it takes 3 byte_chars bytes (which are hexadecimal), and then converts them to a long?</p>
  
  <pre><code>- (NSString *)starFromFlags:(NSString *)flags {
      unsigned char wholeByte; 
      char byte_chars[3];
      NSString *star = @"NO";
  
      byte_chars[0] = '0'; 
      byte_chars[1] = [flags characterAtIndex:1]; 
      byte_chars[2] = 0; 
      wholeByte = strtol(byte_chars, NULL, 16); 
  
      if (wholeByte &amp; 0x01) star = @"YES";
  
      return star;
  }
  </code></pre>