Returns information about the lengths of a compressed file
#include <nwfinfo.h>
int NWGetCompressedFileLengths (
int handle,
LONG *uncompressedLength,
LONG *compressedLength;
(IN) Specifies the file handle for which to return the lengths.
(OUT) Points to the length of the file in an uncompressed state.
(OUT) Points to the length of the file after being compressed.
NWGetCompressedFileLengths returns information about the lengths of a compressed file.
If handle represents a file that is not compressed, the lengths will be invalid.
uncompressedLength specifies the length normally seen in directory listings.
The following code will open the file and enable it to be read without decompression:
#include <nwfileng.h>
#include <nwfattr.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <nwfinfo.h>void main()
{
int handle;
LONG uncom, com;
handle=FEsopen("sys:\\compress\\test",O_RDONLY,H_DENYWR,S_IREAD,
ENABLE_IO_ON_COMPRESSED_DATA_BIT, PrimaryDataStream);
NWGetCompressedFileLengths(handle, &uncom, &com);
printf("The compressed size is %d and the uncompressed size is %d.", com,
uncom);
close (handle);
}
The important parameter to FEsopen is S_IREAD, ENABLE_IO_ON_COMPRESSED_DATA_BIT. If this bit is not set, NWGetCompressedFileLengths uncompresses the file as it is read, which causes the resulting data to be inaccurate and leaves the file in an uncompressed state.