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
GZWRITE(3) 1 GZWRITE(3)gzwrite - Binary-safe gz-file writeSYNOPSIS
int gzwrite (resource $zp, string $string, [int $length])
DESCRIPTION gzwrite(3) writes the contents of $string to the given gz-file.
PARAMETERS
o $zp
- The gz-file pointer. It must be valid, and must point to a file successfully opened by gzopen(3).
o $string
- The string to write.
o $length
- The number of uncompressed bytes to write. If supplied, writing will stop after $length (uncompressed) bytes have been written
or the end of $string is reached, whichever comes first.
Note
Note that if the $length argument is given, then the magic_quotes_runtime configuration option will be ignored and no
slashes will be stripped from $string.
RETURN VALUES
Returns the number of (uncompressed) bytes written to the given gz-file stream.
EXAMPLES
Example #1
gzwrite(3) example
<?php
$string = 'Some information to compress';
$gz = gzopen('somefile.gz','w9');
gzwrite($gz, $string);
gzclose($gz);
?>
SEE ALSO gzread(3), gzopen(3).
PHP Documentation Group GZWRITE(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)