★ wanayoo — archive 1999 http://www.php.net/manual/hu/function.rewind.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Filerendszer
Quick Reference
English version of this pageGerman version of this pageJapanese version of this pageItalian version of this pageFrench version of this page
Filerendszer
* basename
* chgrp
* chmod
* chown
* clearstatcache
* copy
* delete
* dirname
* diskfreespace
* fclose
* feof
* fgetc
* fgetcsv
* fgets
* fgetss
* file
* file_exists
* fileatime
* filectime
* filegroup
* fileinode
* filemtime
* fileowner
* fileperms
* filesize
* filetype
* flock
* fopen
* fpassthru
* fputs
* fread
* fseek
* fstat
* ftell
* ftruncate
* fwrite
* set_file_buffer
* is_dir
* is_executable
* is_file
* is_link
* is_readable
* is_writeable
* link
* linkinfo
* mkdir
* pclose
* popen
* readfile
* readlink
* rename
* rewind
* rmdir
* stat
* lstat
* realpath
* symlink
* tempnam
* touch
* umask
* unlink
Manual: rewind
View the source code for this pageSearch the site



Previous page
 rename
 Updated
Sat, 12 Aug 2000
rmdir 
Next page


rewind

(PHP3 , PHP4 )

rewind -- Rewind the position of a file pointer

Description

int rewind (int fp)

Sets the file position indicator for fp to the beginning of the file stream.

If an error occurs, returns 0.

The file pointer must be valid, and must point to a file successfully opened by fopen().

See also fseek() and ftell().


User Contributed Notes: rewind


g-force@gforce.forss.com
07-Mar-2000 04:10
This rewind command seems quite godd to use, just that i cant understand how?

Can I use it to go back to the beginnning of a file and then enter the information that I want to be placed there? Or how?



phpstuff@tb2.com
19-Mar-2000 07:20
i cannot figure out how to use rewind either. if i put $fp=rewind($fp); it wont work and if i put rewind($fp); it just ignores it. helpie! thanks.


Service@Andorien.de
31-Mar-2000 05:27
Ok. Rewind brings me to the beginning of a file.
What brings me to the end? Because i need to just keep on adding info to a text istead of overwriting it again!
Shouldn't there be some kind of EoF thing?

Thanks!



bann@fortunecity.com
16-Apr-2000 03:55
This is what I did to open a file and add to the end, it was the only way that would work for me..
<PRE>
$fp0 = fopen("file_to_open.txt", "r");
fclose($fp0); //Close the file fp0
$fp1 = fopen("same_file_as_above.txt", "w");
fwrite($fp1, "Text To Add");
fclose($fp1); //Close the file fp1
</PRE>
Hope I helped a little bit.



bann@fortunecity.com
16-Apr-2000 03:58
Oops. Missed a line.. This goes between
<PRE>$fp0 = fopen($fnews, "r");</PRE>
and
<PRE>fclose($fp0);</PRE>...
Add this:
<PRE>$contents = fread($fp0, filesize(file_to_open.txt));</PRE>




richard@stupid.net-ronin.org
05-Aug-2000 10:14
To add text to the end of a file use
fopen("$path/$filename", "x")



 About Notes


Previous page
 rename
 Updated
Sat, 12 Aug 2000
rmdir 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.