Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.
Composition Setup
import.css=/download/attachments/6062824/tecnologia.css

...

Pagetitle
GzStrDecomp
GzStrDecomp

Descompacta uma string no formato gzip.

Sintaxe

Bloco de código
collapsefalse
GzStrDecomp( < cSource >, < nSourceLen >, < @cTarget > )

Parâmetros

Nome

Tipo

Descrição

Obrigatório

Referência

cSource

caractere

Indica a string que está compactada.

X

...


nSourceLen

numérico

Indica o tamanho da string compactada.

X

...


cTarget

caractere

Indica a string descompactada.

X

X

Retorno

Nome

Tipo

Descrição

lRet

lógico

Retorna .T. se a descompactação for realizada com sucesso;

...

caso contrário, retorna .F..

) caso contrário.
Informações
icontrue
title
Observações
  • Essa função descompacta um string no formato gzip (GNU zip).
  • Caso haja um erro na descompactação, é definido em cTarget uma string vazia ("").

Exemplos

EclipsetitleExemplo 1
Bloco de código
theme
languagecpp
theme
Eclipse
linenumberstrue
collapsefalse
user function exemplo
#include "TOTVS.ch"
User Function Exemplo()

  Local lRet      := .F.
  Local 
cComp
cDataText := ""
  Local cCompText := ""
, cUncomp

  Local cDecText  := ""
  Local nDataLen  := 0
  Local 
nLenComp
nCompLen  := 0
, nLenUncomp

  Local nDecLen   := 0

  cDataText := "Testing function GzStrDecomp..."
  
cComp
nDataLen  :=
MemoRead( "\mygzip.gz
 Len( cDataText )

  ConOut( "cDataText [" + cDataText                  + "]" )
  ConOut( "nDataLen  [" + AllTrim( Str( nDataLen ) ) + "]" )

  
nLenComp
lRet := 
Len( cComp
GzStrComp( cDataText, @cCompText, @nCompLen )
  If ( lRet == .F. )
  
cUncomp
  
:=
ConOut( "GzStrComp   call NOK" )
  Else
    ConOut( "GzStrComp 
nLenUncomp := 0
  call OK" )
  EndIf

  lRet := GzStrDecomp( 
cComp
cCompText, 
nLenComp, @cUncomp ) nLenUncomp := Len( cUncomp ) nHandle := FCreate( "\myfile.txt" ) FWrite( nHandle, cUncomp, nLenUncomp ) FClose( nHandle ) return

Veja também

GzStrComp
nCompLen, @cDecText )
  If ( lRet == .F. )
    ConOut( "GzStrDecomp call NOK" )
  Else
    ConOut( "GzStrDecomp call OK" )
  EndIf

  nDecLen  := Len( cDecText )

  ConOut( "cDecText  [" + cDecText                   + "]" )
  ConOut( "nDecLen   [" + AllTrim( Str( nDecLen  ) ) + "]" )

  If ( cDecText <> cDataText )
    ConOut( "cDecText <> cDataText" )
    lRet := .F.
  Else
    ConOut( "cDecText == cDataText" )
  EndIf

  If ( nDecLen <> nDataLen )
    ConOut( "nDecLen  <> nDataLen" )
    lRet := .F.
  Else
    ConOut( "nDecLen  == nDataLen" )
  EndIf

  If ( lRet == .F. )
    ConOut( "GzStrDecomp NOK" )
  Else
    ConOut( "GzStrDecomp OK" )
  EndIf

Return

Abrangência

Application Server 13.0.0.0

Veja também