Re: question..
| From: | Hans H. Anderson | Date: | Wed, 16 Aug 2000 16:45:52 +0000 |
| Subject: | Re: question.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-12077@lists.php.net to get a copy of this message | ||
Tyler,
Not to be too picky, but according to the manual (and my experience) the
"+" means 'open for read and write', where an 'a' with no
'+' means open
for write. The 'a' mode will attempt to create the file if it doesn't
exist regardless (so will 'w' and 'w+', the difference in 'a' and
'w'
being whether the file is truncated to zero or appended and that 'a' puts
the pointer at the end of the file).
Also, that is an argument to fopen(), not fputs(). The file must first be
opened by fopen(), unless this has changed in PHP4 (which I have not
upgraded to yet).
Hans
On Wed, 16 Aug 2000, Tyler Longren wrote:
> fputs("text.txt",$text, a+);
>
> that should write it to the end
> The a stands for append and the + means that if the file doesn't exist,
> creat it.
> >
> > fputs("text.txt",$text); writes the $text to the beginning of the file
> > how can I write text to end of a file ???
> >
> > tauntz
Hans Anderson ~ me@hansanderson.com
PO Box 426, Missoula, MT 59806 | PHP, Search Engines, SQL
(800)397-9116 / (406)549-6524 | Databases, Flash Multimedia,
http://www.hansanderson.com | Killer Audio Production,
http://www.goofiness.com | Minty Fresh Breath.