Re: Problem with the fwrite function (not as simple as it sounds though)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello again, some extra info on my case:
the fwrite is completely fine, when fopen is in 'a' mode!
Thus leading to a temporary workaround like this:

$file = "/wwwroot/file"
$countt = explode(".", fread(fopen($file,"r"), filesize($file)));
$count=$countt[1];
$count++;
$handle=fopen($file,"a");
ftruncate($handle, 1);
fwrite($handle,$file);
fclose($handle);

Now having a file with content in the form:
.15
makes it possible to use the above as a workaround..
but still I need to find out what's the problem here. The counter isn't exactly the only thing I use fwrite for..

The clue I got is, non-empty files are ok to be written in (appended), empty on the other hand, are totaly uncool for that.
So using a ftruncate($handle,0); is just as I'd use fopen($file,"w");
(gives the same result).

--
Best wishes
Still hoping for Your help
Łukasz Hejnak

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux