2

I'm trying to send an image in C++ using sockets.

The problem I'm facing is reading the image as binary base64 and then inserting it in a char array in order to send it.

I would really appreciate if you can help me or give me a tip on how to read the image as binary base64 then insert it into a char array.

Thank you!

firewall
  • 638
  • 1
  • 7
  • 23

1 Answers1

2

You should first read the file as binary. And then use the read buffer to encode as base64 and send it over to the recipient. Try readying binaryIO in C++ and there are a lot of base64 libraries e.g. apache , openssl etc.

For Binary IO. Read binary file c++ http://courses.cs.vt.edu/cs2604/fall02/binio.html

Base64 : how to convert the binary string into base64 Encode data..?

Community
  • 1
  • 1
Adnan Akbar
  • 718
  • 6
  • 16