DecodeFile Function  
 
BOOL WINAPI DecodeFile(
  LPCTSTR lpszInputFile,  
  LPCTSTR lpszOutputFile,  
  DWORD dwOptions,  
  DWORD dwReserved  
);

The DecodeFile function opens and decodes an encoded file, storing the contents in the specified file.

Parameters

lpszInputFile
A null-terminated string which 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 CON: is specified as the file name.
lpszOutputFile
The name of the file that is to contain the decoded file 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.
dwOptions
An unsigned integer which specifies the decoding method and optional behaviors. The low-word of this parameter specifies the decoding method and the high-word specifies additional options. You may only select one decoding algorithm or the function will fail.
Value Description
FILE_DECODE_BASE64 Use the Base64 algorithm, a widely supported method for encoding binary data as text. It is the standard used by most modern email clients and web applications. This is the default encoding algorithm and should be used by most applications.
FILE_DECODE_UUCODE Use the uuencode algorithm, a legacy encoding format traditionally used on UNIX systems and in early email software. This option is primarily included for compatibility with older applications. This algorithm should not be used with new applications.
FILE_DECODE_QUOTED Use the quoted-printable encoding scheme, which encodes only non-printable characters. Often used in email messages to preserve text readability while ensuring compatibility. This algorithm should only be used when the content is primarily text which may include some 8-bit characters. Do not use this algorithm to encode large amounts of binary data.
FILE_DECODE_YENCODE Use the yEnc algorithm, a compact encoding method commonly used for binary file attachments in Usenet newsgroups. It offers higher efficiency than traditional uuencode or Base64. This algorithm is primarily used with USENET newsgroups.
FILE_DECODE_BASE58 Use the Base58 algorithm, which produces a compact, human-readable encoded string. Commonly used for short binary identifiers such as cryptocurrency addresses. This algorithm should not be used with large files. Refer to the remarks below for more information about Base58.
FILE_ENCODE_BASE32 Use the Base32 algorithm, which encodes binary data into a limited set of 32 alphanumeric characters. Commonly used in systems where case-insensitive encoding is required or where data may be transcribed manually. See remarks below for more details about Base32.
FILE_ENCODE_BASE85 Use the Base85 algorithm, which encodes binary data into a more compact form than Base64. Useful when file size reduction is critical and full ASCII compatibility is required. See remarks below for more details about Base85.
FILE_DECODE_COMPRESSED Compress the file prior to encoding. This option may be combined with an encoding method to reduce file size. The resulting file must be decompressed after decoding.
dwReserved
This parameter is reserved and should always be set to zero.

Return Value

A non-zero value is returned if the file was successfully decoded. A zero value indicates that the file does not exist, the encoded file was damaged or the output file could not be created.

Remarks

The DecodeFile function decodes files that were previously encoded through a call to the EncodeFile function or by a third-party application such as an email client. The option to expand a previously compressed file requires that the function be able to create a temporary file on the local system in the directory specified by the TEMP environment variable. This function can only expand a file that was previously compressed with the EncodeFile or CompressFile functions.

For more information about the encoding algorithms, refer to the EncodeFile function.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csncdv12.lib
Unicode: Implemented as Unicode and ANSI versions

See Also