buffer_base64_decode_ext(buffer, str, offset)

From ENIGMA
Jump to navigation Jump to search

Description

Decodes an encoded base64 string into the given buffer at the given offset.

This function copies the bytes decoded from a base64 encoded string into a buffer at a given offset. Based on the buffer type, four cases are possible:

  • buffer_wrap: If the offset goes beyond the end of the buffer, it is wrapped around to the beginning.
  • buffer_grow: If there is not enough space in the buffer to store the decoded data, the buffer is resized to be big enough
  • buffer_fixed: If the offset is beyond the end of the buffer, the write is aborted
  • buffer_fast: If the offset is beyond the end of the buffer, the write is aborted

Also see:

Parameters

Parameter Data Type Description
buffer buffer_t The handle to the buffer being written to
str std::string The string containing the base64 encoded data
offset std::size_t The offset into the buffer where the write will begin from (in bytes)

Return Values

void: This function does not return anything.

Example Call

// demonstrates decoding a base64 encoded registration key from an ini file
var buff;
buff = buffer_create(16384, buffer_grow, 2);
ini_open("settings.ini");
buffer_base64_decode_ext(buff, ini_read_string("RegKey", "Main", ""), 0);
ini_close();