xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

SX_FCompress()

Compresses a file.

Syntax

SX_FCompress( <cSourceFile>, <cTargetFile> ) --> lSuccess

Arguments

<cSourceFile>
This is the name of the source file to compress. It must include path and file extension.
<cTargetFile>
This is the name of the target file to create. It must include path and file extension.

Return

The function returns .T. (true) when the compressed target file is successfully created, otherwise .F. (false) is returned.

Description

Function SX_FCompress() reads the entire file <cSourceFile> and writes its compressed contents into the new file <cTargetFile>. If <cTargetFile> exists already, it is overwritten without warning.

Info

See also:HB_Compress(), SX_FDecompress()
Category: File functions , Six driver
Source:rdd\hbsix\sxcompr.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example compresses a MAP file to demonstrate the size of
// a compressed file.

   PROCEDURE Main
      LOCAL cSource := "sx_Fcompress.map"
      LOCAL cTarget := "sx_Fcompress.cmp"

      ? FileSize( cSource )                 // result: 246331

      ? SX_FCompress( cSource, cTarget )    // result: .T.

      ? FileSize( cTarget )                 // result:  63286

   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe