cpp-base64 | base64 encoding and decoding with c++ | Base64 library
kandi X-RAY | cpp-base64 Summary
kandi X-RAY | cpp-base64 Summary
base64 encoding and decoding with c++
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of cpp-base64
cpp-base64 Key Features
cpp-base64 Examples and Code Snippets
Community Discussions
Trending Discussions on cpp-base64
QUESTION
I am attempting to convert a .jpg file into base64 then into an svg file but my base64 is wrong I don't know if I'm doing something obviously wrong this is my first time working with base64 in c++
When I run the code I get an svg file with the proper format and the correct padding but the file is blank when I open it.
Here's my code:
...ANSWER
Answered 2020-Jun-07 at 19:56Your error is in the way you read the data from the file. Don't use getline
on a binary file, apart from anything else it does not return the newlines to you. The second problem is that by using c_str()
when you append each line you are assuming that there will be no null characters in your data, which is very unlikely to be true.
The simplest way to do this would be to read the file one character at a time
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install cpp-base64
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page