Á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

...

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

...

Nome

Tipo

Descrição

lRet

lógico

Retorna .T. se a descompactação for realizada com sucesso; caso contrário, retorna .F..

Informações
icontrue
titleObservaçõ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

Bloco de código
themeEclipse
languagecpp
titlethemeExemplo 1Eclipse
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 nLenCompnCompLen  := 0, nLenUncomp
  Local nDecLen   := 0

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

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

  nLenComplRet := LenGzStrComp( cCompcDataText, @cCompText, @nCompLen )
  If ( lRet == .F. )
   cUncomp :=ConOut( "GzStrComp   call NOK" )
  Else
  nLenUncomp := 0  ConOut( "GzStrComp   call OK" )
  EndIf

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

Veja também

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