cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: conversion from binary string to base64

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 25 Sep 2007 12:28:06 +0200 (CEST)

On Mon, 24 Sep 2007, Marco Antonio wrote:

>> Sure! You first convert/encode your data the way you like it, then you pass
>> it on to CURLOPT_POSTFIELDS. Optionally you also use CURLOPT_POSTFIELDSIZE
>> to set the size of the data unless it is indicated with a trailing zero
>> byte.
>
> Yes, in php for exemple is very easy (base64_encode(string)), but I need to
> encode it in C/C++ (to pass the data with libcurl) and I do not know how.
> Does exist anything already done about this encoding?

Only about a million different people, functions and projects. You could try a
search engine to find them[*]. Even libcurl has its own base64 encoding
function internally. See curl/lib/base64.c.

[*] = one example being koders.com, like this URL:
    http://www.koders.com/default.aspx?s=base64+encode&btn=&la=*&li=*
       or possibly google's code search, like this URL:
    http://www.google.com/codesearch?q=base64+encode&hl=en&btnG=Search+Code

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-09-25