Bug #2829: writing in a file with fwrite()
| From: | arthur dot angelier at iq3 dot nl | Date: | Thu, 25 Nov 1999 15:04:23 +0000 |
| Subject: | Bug #2829: writing in a file with fwrite() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-13108@lists.php.net to get a copy of this message | ||
From: arthur.angelier@iq3.nl
Operating system: Windows NT
PHP version: 3.0.11
PHP Bug Type: Other
Bug description: writing in a file with fwrite()
First of all, i like PHP verry much.
It's an easy to learn and very usefull language.
Still i have a little problem.
I open a file with fopen() and i read in it with fread().
Then i set the filepointer with fseek() and i verify that
action with ftell().
So far all goes well.
But when i write to the file with fwrite(), i find that
the bytes i wrote are always appended to the file and not
written somewhere in the middle, at the position that i
placed the filepointer on.
So if i have a file with, let's say, 20 bytes (0 - 19),
and i position the filepointer at byte 10, then i should be
able to write in the middle of the file, right?
This doesn't happen.
And how can i truncate an opened file to a specific length?
I want to truncate this file with 20 bytes to a length of
14 bytes. How can i do this?