../pvss.htm menu.gif basics.gif

gzread()

Reads maximum "len" bytes from the file "path" into the variable "content".

caution.gifCAUTION

Under Solaris a zlib  (libz.so) version 1.2.3 is required for the use of the zip functions. Download the zlib version from the internet.

Synopsis

int gzread(string path, string | blob &content, int len[, int offset]);

Parameters

    Parameter

    Description

    path

    Describes the file. If the file does not end with ".gz", The function adds ".gz" to the file name.

    content

    The function reads the bytes from the file into the variable content. The variable has to be of type string or blob. Anytype and mixed are not allowed.

    len

    The function reads maximum of len compressed bytes.

    offset

    The function reads as of the position offset, the compressed data.

Return value

Number of bytes the function read.

0 if the function does not read any bytes,

-1 in case of an error.

Error

The function returns -1 in case of errors.

Description

Reads maximum "len"; bytes from the file "path"; into the variable "content";.

IconExample

The function gzwrite() compresses the content and writes the result into the file test2.txt. The function gzread() reads 30 bytes from the file test2.txt into the variable tar.

    #uses "CtrlZlib"
    main()
    {
      
      string cont = "Hello this is the second test";
      string filPath = "c:/test2.txt";
      gzwrite(filPath, cont);
      DebugN("Compressed content", filPath);
      
      int retVal;
      string tar;
      int len = 30;
      retVal = gzread(filPath, tar, len);
      DebugN("Return value:", retVal, "Content", tar);
    }

Member of

File function

Availability

 

See also

 

page_top.gif

 

V 3.11 SP1

Copyright ETM professional control GmbH 2013 All Rights Reserved