[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
R_DCmpFile()
Extract one or more files from an RCmpLib archive
------------------------------------------------------------------------------
Syntax
nRetCode := R_DCmpFile ( cRcpFile, acFiles [, cDrvPath
[, nBarLen [, nBarRow [, nBarCol [, cBarChr
[, cBarColor [, cPassWord [, lEscape [, bRCmpBlk
] ] ] ] ] ] ] ] ] )
Arguments
cRcpFile Name of the archive file to extract files from
Format : [drive:][\path\]filename[.ext]
Example : C:\INVOICE\INVOICE.ZIP
Default extension is .RCP
acFiles Name(s) of file(s) to extract from the archive
Array format : { '*.DBF', '*.NTX' }
String format : '*.DBF'
Default : '*.*'
The filenames may contain the DOS wildcards,
* and/or ?.
A filename may NOT include drives and/or paths
cDrvPath Drive and/or path where file should be extracted to
Default : current directory
nBarLen Length of the progression bar
Default : 0 = no progression bar
nBarRow Screen row for the progression bar
Default : centered on the screen
nBarCol Screen column for the progression bar
Default : centered on the screen
cBarChr Character used for displaying progression bar
Default : # = Chr ( 219 )
cBarColor Color of the progression bar. This is a Clipper
color string.
Default : 'GR+/G' = Yellow on Green
cPassword Password for decryption of the archive file.
The maximum length of the password is 10 characters.
Default : no decryption
NOTE : the password is case-sensitive !
lEscape .F. : compression can't be interrupted by
the user
.T. : compression may be interrupted by pressing
the <Esc> key
Default : .F. = no interruption
bRCmpBlk CodeBlock that is evaluated once per acFiles
element.
The current acFiles element is passed to bRCmpBlk.
Returns
nRetCode Return code
Possible return codes :
0 = CP_OKAY No errors detected
1 = CP_INVALID_PARM Invalid parameter passed
2 = CP_OPEN_INPUT Error opening archive file
3 = CP_NOT_RCMPLIB Archive not compressed by
RCmpLib
- or -
Incorrect password
4 = CP_WRONG_VERSION Earlier version of RCmpLib
5 = CP_CREATE_OUTPUT Error CREATING archive file
6 = CP_READ_INPUT Error READING input file
7 = CP_WRITE_OUTPUT Error WRITING output file
9 = CP_USER_ABORT Compression aborted by user
See also the item ErrorCodes in this guide.
Description
Extracts one or more files from a RCmpLib archive.
If the archive is created with password encryption, the same
password should be passed when extracting the file.
If the password is incorrect, a CP_NOT_RCMPLIB error will be
returned.
The timestamp of the original (uncompressed) files will be restored
after the decompression.
Example
*-- Header file of RCmpLib
#include "RCmpLib.CH"
LOCAL nRetCode && Return code R_Compress
LOCAL aCmpError := CP_ERRMSG && Array with error msgs
*--------------------------------------------------------------------
* Extract the *.DBF & *.NTX files from the archive C:\DB\ARCHIVE.RCP
* Place the extracted files in the C:\DBDAT directory
* Use a progression bar, 20 chars long, centered, default char (#),
* barcolor = Bright White on Blue
* Password = TESTPW
* Non interruptable ( lEscape = .F. )
* Show the file skeletons using the ShowSkel () function
*--------------------------------------------------------------------
nRetCode := R_DCmpFile ( 'C:\DB\ARCHICE.RCP', { '*.DBF', '*.NTX' }, ;
'C:\DBDAT', 20, nil, nil, nil, 'W+/B', 'TESTPW', .F., ;
{ |x| ShowSkel (x) } )
IF nRetCode != CP_OKAY
*-- Oops, error while extracting ...
*-- Display the error message
ALERT ( 'Extraction error : ' + aCmpError [nRetCode] )
ENDIF
QUIT
*------------------------------------------------------------------
* Display the skeleton of the files being extracted
*------------------------------------------------------------------
FUNCTION ShowSkel ( cFileName )
*-- This is the codeblock function which displays
*-- the name of the file being compressed
DevPos ( 0, 0 ) && Just above the bar ...
DevOut ( 'Extracting : ' + PadR ( cFileName, 12 ) )
RETURN CP_CONT && Continue compression
More examples can be found in the demo program RCmpDemo.PRG.
Caution
+----------------------------------------------------------------+
| -+- CAUTION -+- |
| |
| IN THE UN-REGISTERED VERSION OF RCMPLIB THE FOLLOWING |
| REGISTRATION MESSAGE WILL BE DISPLAYED AT RANDOM TIMES |
| (WHILE EXECUTING THE R_DCmpFile() FUNCTION) : |
| |
| UN-Registered version of RCmpLib -+- Please wait for 8 seconds |
| |
| AFTER A 8 SECONDS DELAY THE PROGRAM WILL CONTINUE. |
+----------------------------------------------------------------+
.
See Also:
R_CmpFile()
R_CmpList()
R_IsRCmp()
ErrorCodes
Registration
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson