GZREAD(3) 1 GZREAD(3)gzread - Binary-safe gz-file readSYNOPSIS
string gzread (resource $zp, int $length)
DESCRIPTION gzread(3) reads up to $length bytes from the given gz-file pointer. Reading stops when $length (uncompressed) bytes have been read or EOF
is reached, whichever comes first.
PARAMETERS
o $zp
- The gz-file pointer. It must be valid, and must point to a file successfully opened by gzopen(3).
o $length
- The number of bytes to read.
RETURN VALUES
The data that have been read.
EXAMPLES
Example #1
gzread(3) example
<?php
// get contents of a gz-file into a string
$filename = "/usr/local/something.txt.gz";
$zd = gzopen($filename, "r");
$contents = gzread($zd, 10000);
gzclose($zd);
?>
SEE ALSO gzwrite(3), gzopen(3), gzgets(3), gzgetss(3), gzfile(3), gzpassthru(3).
PHP Documentation Group GZREAD(3)
Check Out this Related Man Page
GZOPEN(3) 1 GZOPEN(3)gzopen - Open gz-fileSYNOPSIS
resource gzopen (string $filename, string $mode, [int $use_include_path])
DESCRIPTION
Opens a gzip (.gz) file for reading or writing.
gzopen(3) can be used to read a file which is not in gzip format; in this case gzread(3) will directly read from the file without decom-
pression.
PARAMETERS
o $filename
- The file name.
o $mode
- As in fopen(3) ( rb or wb) but can also include a compression level ( wb9) or a strategy: f for filtered data as in wb6f, h for
Huffman only compression as in wb1h. (See the description of deflateInit2 in zlib.h for more information about the strategy param-
eter.)
o $use_include_path
- You can set this optional parameter to 1, if you want to search for the file in the include_path too.
RETURN VALUES
Returns a file pointer to the file opened, after that, everything you read from this file descriptor will be transparently decompressed
and what you write gets compressed.
If the open fails, the function returns FALSE.
EXAMPLES
Example #1
gzopen(3) Example
<?php
$fp = gzopen("/tmp/file.gz", "r");
?>
SEE ALSO gzclose(3).
PHP Documentation Group GZOPEN(3)
Ok this is probably pretty easy but I'm stuck.
My program reads the contents of a txt file and stores the string into a char array called buff. The contents of the text file is a string of a txt file name. So basically buff has this value "file.txt\0". The last part is the null character. I want... (3 Replies)
I need to be able to get the length of a specific file. If the file length <> 0, then I need to email it to an address.
I tried this:
if
then
(cat $DSDIR/non_reporting_stores.txt) | mail -s "Daily Non Reporting Stores" xyz@xysz.com
fi
which gave me a syntax error that it could not... (1 Reply)
I have a requirement to go to particular line in the file and from there read the contents till it meets a particular criteria. For eg if the contents of the file is like
81 abcd ------------------- Line 1
82 cdfe ------------------- Line 2
83 dfj ------------------- Line 3
84 df... (5 Replies)
When I gzopen & gzread from a gzip file, it works OK. But I when I try to uncompress the same data from memory (either by reading to memory with fread or mmap()ing) using decompress, I get Z_DATA_ERROR. Is it because gzip file has some kind of headers that uncompress doesn't want?
How can I get... (3 Replies)
Hi
My requirement is to read the contents of a fixed length file and validate the same.
But am not able to read the contents of the file and when i tried it to print i get <blank> as an output...
I used the below satatements for printing the contents
... (3 Replies)
i have a file a.txt contents as 1,2,3,4,......etc...in a single line, i want to write to another file in rows as
1
2
3
4
5
can u help?
i do not know the length of a.txt (4 Replies)
Hello,
I have two files in this form that consist of three columns, a name (L*contig*), the length (length=**) and the sequence
LT_file.txt
LTcontig1 length=13 acccatgctttta
LTcontig5 length=8 ggattacc
LTcontig8 length=20 ccattgaccgtacctgatcg
LTcontig23 length=5 accta
and... (5 Replies)