The situation is taking the base64 and encoding in base 16 for most of the character systems that are used in email. But I am assuming that a base64 number is multiple bytes in length and is stored in a binary format which I can break down byte by byte and could be encoded to MIME fairly easily. If I wanted to insert text it, I would just count the bytes going by in the Mime encoding and stop the process print what I needed to print or what ever I was doing, like breaking up across multiple emails.
The base64 file has to be encode as a base16 on the disk. So storing the file is just printing the bytes of the file to which ever subsystem I needed to which I am Assuming MIME takes a unsigned char* of some form to encode its info. unsigned char is the equivalent to a single byte of information the base of the byte is irrelevant except to what ever needs to translate it on the other end after decoding.
Thank you for the reply. It looks like opening in binary mode doesnot help either. What is interesting is that with a simple code to open this base64 file & write to another fie after reading with "getline" works in text mode.
Also Wikipedia says base64 is a way to represent a binary file as text so that it can be set va text only smtp.
BTW, I use "zip" & "OpenSSL enc -base64" to generate base64 file of a zipped file. If I use a simple bash script to build a mime file to email, it works.
I thought I can consider the contents of base64 file as text so that I can read in text mode & use stringstream to hold the full file etc.