- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Using the LzExpand functions in your applications

Question:

How do I use the LzExpand functions in my application?

Answer:

Here is an example that will decompress a file that was compressed

using the Microsoft compress.exe utility utilizing the -r (rename) 

command line switch. Note: If you already know the expanded name of 

the file, or it was not compressed with the -r command line switch, 

then simply omit the code associated with the GetExpandedName 

function, and directly hard code the file name as needed.



uses LzExpand;



{$IFNDEF WIN32}

const MAX_PATH = 144;

{$ENDIF}

procedure TForm1.Button1Click(Sender: TObject);

var lpDstFileName : PChar;

  SrcFile : integer;

  DstFile : integer;

  SrcOs : TOFSTRUCT;

  DstOs : TOFSTRUCT;

begin

   GetMem(lpDstFileName, MAX_PATH);

   GetExpandedName('C:\TestFile.bi_', lpDstFileName);

   SrcFile := LZOpenFile('C:\TestFile.bi_', SrcOs, OF_READ);

   DstFile := LZOpenFile(lpDstFileName, DstOs, OF_CREATE);

   LZCopy(SrcFile, DstFile);

   LZClose(SrcFile);

   LZClose(DstFile);

  FreeMem(lpDstFileName, MAX_PATH);

end;



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile