Re: Re: fopen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard, thanks.

> >  chmod($defaultfile, 666);
> http://php.net/chmod
> has examples that tell you exactly why this is wrong...
> The 666 you want is Octal.

chmod($defaultfile, 0666);
Check. Thanks. Didn't pay enough attention to that.

> > What does the at_sign mean at the start of this line?
> > @ $results = fopen($datafilename, "w+");
> @ means you are IGNORING any errors this generates.

Hmm. Thanks. Decent to know.

> >  flock($results, 2); #lock file for writing
> >  fwrite($results, $filestr); #write $filestr to $results
> >  flock($results, 3); #unlock file
> >  fclose($results); #close file
> This is an incorrect way to try to flock a file for writing.
>
> You should:
> 1) Open the file for READING.
> 2) flock that file handle, so only YOU have access to that file.
> 3) Re-open the file for WRITING, now that you have control.
> 4) Write your data
> 5) Release the lock.

Could you show me a correct method, or example please? I admit I'm a little too newbie with flock. I have not used it since my Perl days, and even then ...

> http://l-i-e.com/artists.htm

Didn't know that!

Thanks,
John

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux