title: convert string to unsigned char str
body: <p>I am trying to convert a string into a unsigned char *. And i've been running in circles.  My program prompts the user for a lastname which i take in as a string.  I am then hashing the string into an integer using djb2. which takes an unsigned char * as a parameter. The goal of my program is to create a hash table using chaining to handle collisons.</p>
  
  <pre><code>unsigned long djb2(unsigned char *str)
  {
      unsigned long hash = 5381;
      int c;
  
      while (c = *str++)
          hash = ((hash &lt;&lt; 5) + hash) + c; /* hash * 33 + c */
  
      return hash;
  }
  </code></pre>
  
  <p>my code is as follows atm.</p>
  
  <pre><code>void insert(LinkedList&lt;Person&gt;* HashList1[], LinkedList&lt;Person&gt;* HashList2[], int listSize)
  {
      char * cstr;
      string str;
      cin &gt;&gt; str;
      cstr = new char [str.size()+1];
      strcpy (cstr, str.c_str());
      int hashBucket1 = djb2(cstr) % listSize;
  }
  </code></pre>
  
  <p>Im getting an error with the above telling me that "Argument of type "char *" is incompatible with parameter of type "unsigned char *" . Any help is greatly appreciated </p>