You are here: Re: weird fseek and fwrite issue « PHP Programming Language « IT news, forums, messages
Re: weird fseek and fwrite issue

Posted by shimmyshack on 06/07/07 17:01

On Jun 7, 4:17 pm, Feanor <Collin.Moer...@gmail.com> wrote:
> i have the following php code set up to test:
>
> <html>
> <body>
>
> <?php
> if(!$xml = fopen("regData.xml","r+"))
> {
> echo "ERROR: unable to Open regData.xml";
> exit;
> }
>
> fseek($xml, 0, SEEK_END);
> fwrite($xml, "<test>");
> fclose($xml);
>
> ?>
>
> </body>
> </html>
>
> my original regData.xml:
>
> <reg>
>
> </reg>
>
> regData.xml after php code run:
>
> <test>
>
> Any thoughts on why <test> isnt appended to the end of the file so it
> looks like this?:
>
> <reg>
>
> </reg><test>

tried using a+ flag?
and you could of course (php5) use
file_put_contents( $filename, $data, FILE_APPEND );

 

Navigation:

[Reply to this 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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация