Thank you ,Jimmy .


-----原始邮件-----
发件人: Jimmy [mailto:[EMAIL PROTECTED]]
发送时间: 07 January, 2002 12:13
收件人: [EMAIL PROTECTED]
主题: Re: [PHP] How to read/write form/into certain place in a text file


Hi Leon,

> For example,read form letter 5 to 10 in line 4 ,and after some procedure
> ,write into the same place.

if the file is not too big, you can use file() function which will
return an array containing the content of the file per line.
combine this with substr() to read from specific column.
to write use substr_replace().

if the file is big, then doing file() is not advised, you should read
the file as stream. read the following functions:
fopen(), fclose(), fseek(), fread(), fwrite().

>   Another question is that if a user has opened the file to read and write
,
> what will happen if another one will open and write the same file?

php doesnt handle file locking automatically, so i think it would
depend on the OS. if you want to handle file locking, read about flock().

--
Jimmy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
God is greater than your greatest problem


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to