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

The EncodeFile function opens and encodes a file, storing the contents as printable text in the specified file.

Parameters

lpszInputFile
A pointer to a null-terminated string which 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.
lpszOutputFile
The name of the file that is to contain the encoded 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 that specifies one or more options. This parameter is constructed by using a bitwise operator with any of the following values:
Constant Description
FILE_ENCODE_BASE64 Use the base64 algorithm for encoding the file. This is the encoding method that is used by most modern e-mail client software. Note that this option cannot be combined with the other encoding methods.
FILE_ENCODE_UUCODE Use the uuencode algorithm for encoding the file. This is a common encoding method used UNIX systems and older e-mail client software. Note that this option cannot be combined with the other encoding methods.
FILE_ENCODE_QUOTED Use the quoted-printable algorithm for encoding the file. Note that this option cannot be combined with the other encoding methods.
FILE_ENCODE_YENCODE Use the yEnc algorithm for encoding the file. This is an encoding method that is commonly used when posting files to Usenet newsgroups. Note that this option cannot be combined with other encoding methods.
FILE_ENCODE_COMPRESSED The file should be compressed before it is encoded. To restore the original contents of the file, it must be expanded after it has been decoded.
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 encoded. A zero value indicates that the input file does not exist or the output file could not be created.

Remarks

The EncodeFile function converts binary data files to a format that contains only printable ASCII characters. The option to compress the file requires that the function be able to create a temporary file on the local system in the directory specified by the TEMP environment variables. A compressed file must be expanded with the DecodeFile or ExpandFile functions. The compressed file is not stored in an archive format that is recognized by third-party applications such as PKZip or WinZip.

Requirements

Client: Requires Windows 7, Windows Vista or Windows XP.
Server: Requires Windows Server 2008 or Windows Server 2003.
Header: Include cstools7.h.
Library: Use csncdav7.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

CompressFile, DecodeFile, ExpandFile