DecodeFile Method  
 

Decode the contents of the specified file.

Syntax

object.DecodeFile( InputFile, OutputFile, Encoding )

Parameters

InputFile
A string value that specifies the name of the file to be decoded. 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 the console, is specified as the file name.
OutputFile
A string value that specifies the name of the file that will contain the decoded 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 the console, is specified as the file name.
Encoding
The encoding method that was used to create the file. The following encoding methods are valid:
Value Constant Description
0 fileDecodeDefault Use the default encoding method. Currently this is the same specifying that the base64 algorithm should be used for encoding and decoding files.
1 fileDecodeBase64 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.
2 fileDecodeQuoted 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.
3 fileDecodeUucode 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.
4 fileDecodeYencode Use the yEnc algorithm for encoding the file. This is an encoding method that is commonly used when posting files to Usenet newsgroups.
&H10000 fileDecodeCompressed This option is used in combination with one of the encoding types listed above. If specified, the method will decode the file and expand the data, restoring the original file contents.

Return Value

This method returns a value of zero if the file was successfully compressed. A non-zero return value specifies an error code which indicates the reason for the failure.

Remarks

The DecodeFile method decodes the contents of a file that was created using the specified encoding method.

It is permitted to specify an empty string as the output file name. In this case, the control will create a temporary file in the directory specified by the TEMP environment variable. After the file has been compressed, the OutputFile property will be set the name of the temporary file that has been created. It is the responsibility of the application to delete this temporary file after it is no longer needed.

The fileDecodeCompressed option should only be specified if the encoded file was created using EncodeFile method with the fileEncodeCompressed option.

The InputFile, OutputFile and Encoding properties will be updated with the values specified to this method.

See Also

Encoding Property, InputFile Property, OutputFile Property, EncodeFile Method