title: How can I convert an unsigned char array into a base64 string?
body: <p>I have a large buffer array of type <code>unsigned char buffer[2850]</code> that I would like to convert to a Base64 string. I'm trying to use the libb64 library which can be found <a href="https://github.com/cburstedde/libsc/tree/master/libb64" rel="nofollow">on github</a></p>
  
  <p>Here is how I'm trying to convert it:</p>
  
  <pre><code>char* encode(const char* input)
  {
      /* set up a destination buffer large enough to hold the encoded data */
      char* output = (char*)malloc(SIZE);
      /* keep track of our encoded position */
      char* c = output;
      /* store the number of bytes encoded by a single call */
      int cnt = 0;
      /* we need an encoder state */
      base64_encodestate s;
  
      /*---------- START ENCODING ----------*/
      /* initialise the encoder state */
      base64_init_encodestate(&amp;s);
      /* gather data from the input and send it to the output */
      cnt = base64_encode_block(input, strlen(input), c, &amp;s);
      c += cnt;
      /* since we have encoded the entire input string, we know that
       there is no more input data; finalise the encoding */
      cnt = base64_encode_blockend(c, &amp;s);
      c += cnt;
      /*---------- STOP ENCODING  ----------*/
  
      /* we want to print the encoded data, so null-terminate it: */
      *c = 0;
  
      return output;
  }
  
  char *encodedBuffer;
  encodedBuffer = encode(buffer);
  </code></pre>
  
  <p>but I'm getting the warning </p>
  
  <pre><code>Passing 'unsigned char [2850]' to parameter of type 'const char *' converts between pointers to integer types with different sign.
  </code></pre>
  
  <p>Is there a better way to convert it or is there something I need to alter since I'm trying to pass in an unsigned char array. Thanks!</p>