[#OSSL_ENCODER_to_data]
= OSSL&lowbar;ENCODER&lowbar;to&lowbar;data
:mrdocs:

Run encoding for a context and write the result into a memory buffer&period;

== Synopsis

Declared in `&lt;openssl&sol;encoder&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
OSSL&lowbar;ENCODER&lowbar;to&lowbar;data(
    xref:OSSL_ENCODER_CTX.adoc[OSSL&lowbar;ENCODER&lowbar;CTX]* ctx,
    unsigned char** pdata,
    size&lowbar;t* pdata&lowbar;len);
----

== Return Value

1 on success, or 0 on failure (including when a caller&hyphen;supplied buffer is too small)&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *ctx*
| Configured encoder context&period;
| *pdata*
| Address of an output buffer pointer&semi; if &ast;`pdata` is NULL, a buffer is allocated with OPENSSL&lowbar;malloc() and ownership transfers to the caller&period; If non&hyphen;NULL, &ast;`pdata` must point to a buffer of size &ast;`pdata&lowbar;len&period;`
| *pdata&lowbar;len*
| On input, capacity of &ast;`pdata` when non&hyphen;NULL&semi; on success, length of encoded data&period; Required (must not be NULL)&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
