Xceed Binary Encoding Library Documentation
WriteFile method
Xceed Binary Encoding control reference > Methods > WriteFile method

Description

The WriteFile method can be used to encode and decode data from memory and write it directly to a file.

Parameters
 

Parameter Description
vaData  The data to encode. All OLE automation variant types are supported, including string and byte array variants.
eAction  The type of processing that should be performed. Specify bfpEncode to encode data. Specify bfpDecode to decode data.
bEndOfData  Determines whether or not the data provided in the vaData parameter is the final (or the only) portion of data to process. Specify True if the data should be completely encoded or decoded and written to the file. If the data to process must be processed in streaming fashion, then you can specify False in this parameter until all the source data has been processed.

You can specify True for the last portion of data (which can be 0 bytes long) so that the library knows it must finish processing all the provided source data and flush its buffers to the destination file.
sDestFilename  The path and filename of the file to write the encoded or decoded data to. If the file does not already exist, it will be created and written to. If the file already exists, the library can either clear the file and write to it as a new file, or it can append the processed data to the end of the destination file.

When decoding a UUEncoded, XXEncoded or BinHexed file (or data) and the IncludeHeaderFooter property is set to True, you do not need to specify a filename in this parameter. You can specify only a path. In this case, the header information in the UUEncoded, XXEncoded or BinHexed data stream or file will provide the filename. Make sure the path you specify in this parameter ends with a "\".
bAppend  Determines the behavior of the library when the destination file already exists. Specify True to append to an existing file, or False to clear the file and write processed data to it as a new file.

Return value

Returns the amount of bytes written to the destination file.

Associated properties

The EncodingFormat property allows you to specify which encoding format to use when encoding or decoding data.

Associated methods

ToString and FromString

Remarks

When calling the WriteFile method with the bEndOfData parameter specified as False, you cannot call any other Xceed Binary Encoding control method (of the same instance of the control) until you have completed processing a stream of data by calling the WriteFile method with the bEndOfData parameter specified as True.

Declaration (DXceedBinaryEncoding) Copy Code
HRESULT WriteFile
(
  [in] VARIANT* vaData,
  [in] EXBFileProcessing eAction,
  [in] VARIANT_BOOL bEndOfData,
  [in] BSTR sDestFilename,
  [in] VARIANT_BOOL bAppend,
  [out, retval] long* plWritten
)
Declaration (IXceedBinaryEncoding) Copy Code

HRESULT WriteFile
(
  [size_is][in] */ BYTE* pcData,
  [in] DWORD dwDataSize,
  [in] EXBFileProcessing eAction,
  [in] BOOL bEndOfData,
  [in] BSTR sDestFilename,
  [in] BOOL bAppend,
  [out, retval] DWORD* pdwWritten
)