These toy examples are for helping with understanding C/C++. There is an excellent C++ samples site which demonstrates many useful things.
This gist details the following:
Herewith is an example of encoding to and from base64 using OpenSSL's C library. Code presented here is both binary safe, and portable (i.e. it should work on any Posix compliant system e.g. FreeBSD and Linux).
The MIT License (MIT)
Copyright (c) 2013 Barry Steyn
|* This is a very cool method to perform the leetcode task.|
|* It is time O(n) (n being the size of string S) if it is|
|* implemented with an unordered_map on line 65, otherwise it|
|* is O(n*log(m)) (m being the size of the vector L)|
|* This method demonstrates how hashes can be used for|
|* comparison instead of strings. It is inspired by|
|* the topcoder article: http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=stringSearching|