|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[1999-11-25 16:04 UTC] arthur dot angelier at iq3 dot nl
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? PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 18:00:01 2025 UTC |
for #2 there is a ftruncate() function available in php4 for #1: if this still doesn't work with current php3 (or php) i'd like to see some sample code