Reply to Re: [PHP] Problem with the fwrite function (not as simple as it sounds though)

Your name:

Reply:


Posted by £ukasz Hejnak on 10/04/29 11:32

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

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация