|
Encode the contents of the specified file.
Syntax
object.EncodeFile( InputFile,
OutputFile, Encoding )
Parameters
- InputFile
- A string value that specifies the name of the file to be encoded. The file must
exist, and it must be a regular file that can be opened for reading
by the current process. An error will be returned if a character
device, such as CON: is specified as the file name.
- OutputFile
- A string value that specifies the name of the file that will contain the encoded data.
If the file exists, it must be a regular file that can be opened
for writing by the current process and will be overwritten. If the
file does not exist, it will be created. An error will be returned
if a character device, such as CON: is specified as the file
name.
- Encoding
- The encoding method to be used when creating the file. The
following encoding methods are valid:
Value |
Description |
fileEncodeDefault |
Use the default encoding method. Currently this is the same
specifying that the base64 algorithm should be used for
encoding and decoding files. |
fileEncodeBase64 |
Use the base64 algorithm for encoding and decoding files.
This is the standard method for encoding files as outlined in
the Multipurpose Internet Mail Extensions (MIME) protocol. This
is the method used by most modern email client software. |
fileEncodeQuoted |
This encoding method is typically used for text messages
that use characters beyond the standard ASCII character set, in
the range of 128-255. This method, called quoted printable
encoding, allows text messages to pass through mail systems
that do not support characters with the high-bit set. Note that
this method should not be used to encode binary files such as
executables or file archives. |
fileEncodeUucode |
Use the uuencode and uudecode algorithms for encoding and
decoding files. This is a common encoding method used with UNIX
systems and older email client software. |
fileEncodeYencode |
Use the yEnc algorithm for encoding the file. This is an
encoding method that is commonly used when posting files to
Usenet newsgroups. |
&H10000 |
fileEncodeCompressed |
This option is used in combination with one of the encoding
types listed above. If specified, the file will be compressed
prior to being encoded by the control. This can significantly
reduce the size of the encoded output. |
Return Value
This method returns a value of zero if the file was successfully
encoded. A non-zero return value specifies an error code which
indicates the reason for the failure.
Remarks
The EncodeFile method encodes the contents of a file, using
the specified encoding method.
When specifying the fileEncodeCompressed option, it is
important to remember that the compressed, encoded data can only be
restored to its original contents using the DecodeFile method.
This option should not be used when encoding a file to be attached to
an email message unless you provide the recipient with a utility to
decode the data.
See Also
Encoding Property,
CompareFile Method,
CompressFile Method,
DecodeFile Method,
ExpandFile Method
|
|