note 126231 added to function.fwrite
| From: | synnus at gmail dot com | Date: | Fri, 09 Jul 2021 13:25:38 +0000 |
| Subject: | note 126231 added to function.fwrite | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216593@lists.php.net to get a copy of this message | ||
<?php
/*
Write to offset with positive offset
PHP_INT_MIN / PHP_INT_MAX 32-bit PHP: -2,147,483,648 to +2,147,483,647
PHP_INT_MIN / PHP_INT_MAX 64-bit PHP: -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807
File_writing 32bit 0 -> 4Â 294Â 967Â 295
File_writing 64bit 0 -> 18 446Â 744Â 073Â 709Â 551Â 615
$handel = fopen( myfilname );
$t_f_max is max file size in BYTE ex: 19998
$offset is position in offset BYTE ex : 19995
$bin your binary data you want write
Work in 32bit and 64bit
*/
function File_writing($handel,$t_f_max,$offset,$bin) {
($offset > PHP_INT_MAX) ? fseek($handel,-($t_f_max-$offset),SEEK_END) :
fseek($handel,$offset,SEEK_SET);
fwrite($handel,$bin);
return $offset;
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 80.15.1.147)
----
Manual Page -- https://php.net/manual/en/function.fwrite.php
Edit -- https://main.php.net/note/edit/126231
Del: integrated -- https://main.php.net/note/delete/126231/integrated
Del: useless -- https://main.php.net/note/delete/126231/useless
Del: bad code -- https://main.php.net/note/delete/126231/bad+code
Del: spam -- https://main.php.net/note/delete/126231/spam
Del: non-english -- https://main.php.net/note/delete/126231/non-english
Del: in docs -- https://main.php.net/note/delete/126231/in+docs
Del: other reasons-- https://main.php.net/note/delete/126231
Reject -- https://main.php.net/note/reject/126231
Search -- https://main.php.net/manage/user-notes.php