I'm looking to convert audio, images, video to base64 in c++, and through many searches on the web I've only seem to come up with string > base64.
When I view a .mp3 file for example, there are many characters there that are not available to be used in my string to encode.
http://www.adp-gmbh.ch/cpp/common/base64.html
I have this code set up in my project, and all I want is to be able to give the location of any file and have it encode (could just encode to a string, I can handle writing it to a file), and then give a location to put the decoded file as well.
through many searches on the web I've only seem to come up with string > base64.
A file is just a string with characters you might not be able to type on your keyboard. The C++ std::string class can easily hold any file, even with null characters.
I'm just having trouble turning the file into a string.
I've tried this, just to test if I can get a file in and spit it back out, but the resulting file looks extremely similar in notepad, but doesn't work in VLC, Photo viewer etc. when renamed.
Just taking a quick look at the code, I'd say if you are trying to make an exact duplicate of the file into example.txt, you'll need to include newlines as getline() extracts those from the original file but doesn't store them in the string.