Encoding functions :
There are a couple of functions to encode data into a file. You will usually need no more than one of them, depending
on the job you want to execute. The functions also differ in the headers they generate.
All of the functions have a bunch of parameters for greater flexibility. Don't be confused by their number, usually you'll
need to fill only a few of them. There's a number of common parameters which can he explained separately:
- resource outfile : the output stream, where the encoded data is written to. The file pointer must be valid,
and must point to a file successfully opened by fopen().
- mixed infile : where the input data shall be read from. It must be a string containing the filename or a resource.
In the second case, the file pointer must be valid and must point to a file successfully opened by fopen().
- string outfname : the name by which the recipient will receive the file. It is used on the “begin” line for uuencoded
and xxencoded data, and in the headers of MlME-formatted messages. If this parameter is NULL, it defaults to infname.
It must be specified if data is read from a stream.
- int filemode : for uuencoded and xxencoded data, the file permissions are encoded into the "begin" line.
This mode can be specified here. If the value is 0, it will be determined by performing a stat () call on the input file. If this call should fail,
a value of 0644 is used per default.
- int encoding : the encoding to use. One of the four constants UU_ENCODED, XX_ENCODED, B64_ENCODED or YENC_ENCODED.