How to export a GPG private key to a file

C++
gpg --output private.pgp --armor --export-secret-key username@email
Source

Also in C++: