Xceed Streaming Compression Library Documentation
WriteFile method
Xceed Streaming Compression control reference > Methods > WriteFile method

Description

The WriteFile method can compress and decompress data from memory and write it directly to a file.

Parameters
 

Parameter Description
vaData  The data to compress. All OLE automation variant types are supported, including string and byte array variants.
eAction  The type of processing that should be performed. Specify cfpCompress to compress data. Specify cfpDecompress to decompress data. For the WriteFile method, you cannot set this parameter to cfpCalculateCRC32 or cfpCalculareAdler32.
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 compressed or decompressed 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 compressed or decompressed 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.
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

Set the CompressionFormat property to specify the format of the compressed data. This not only determines whether or not the compressed data should contain a checksum such as Adler-32 or CRC , but also in most cases implies which compression algorithm will be used by the library.

Associated methods

ToString and FromString

Remarks

When calling the WriteFile method with the bEndOfData parameter specified as False, you cannot call any other Xceed Streaming Compression 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 (DXceedStreamingCompression) Copy Code
HRESULT WriteFile
(
  [in] VARIANT* vaData,
  [in] EXCFileProcessing eAction,
  [in] VARIANT_BOOL bEndOfData,
  [in] BSTR sDestFilename,
  [in] VARIANT_BOOL bAppend,
  [out, retval] long* lWritten
)
Declaration (IXceedStreamingCompression) Copy Code

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