Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


 
Uses gzip to compress a file on the file system.
 
Related functions:
Header:
#include "sdai.h"
Prototype:
EdmiError edmiCompressFile(SdaiString  uncompressedFile,
                            SdaiString  compressedFile, 
                            SdaiInteger tradeOff, 
                            SdaiReal    *rate);
Arguments:

uncompressedFile

Name of the file to be compressed,

compressedFile

Name of the compressed file.

tradeOff

Integer number between 1 and 9. Optimizes on speed and compression rate respectively.

*rate

Returns the compression rate.

Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0: Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an EDMinterface error code. Use edmiGetErrorText to get the error text corresponding to the error code.
EXAMPLE
EdmiError rstat;
SdaiReal rate;
SdaiString file = "c:/home/johnny/b43_765.stp";
SdaiString compFile = "c:/home/johnny/ b43_765.stp.zip";
. . .
/* Compress */
if (rstat = edmiCompressFile(file, compFile, 4, &rate)) {
printf("\nError %d in edmiCompressFile: %s", rstat,
edmiGetErrorText(rstat)); 
goto error; 
}
printf("\nCompressed %s with Compression Rate: %f", file, rate);
. . .
 
/* Uncompress */
if (rstat = edmiUncompressFile(compFile, file, &rate)) {
printf("\nError %d in edmiUncompressFile: %s", rstat,
edmiGetErrorText(rstat)); 
goto error; 
}
printf("\nUncompressed %s, Compression Rate: %f", compFile, rate);
. . .

  • No labels