Valhalla Legends Archive

Programming => Web Development => Topic started by: Dyndrilliac on April 17, 2006, 11:19 AM

Title: Some clarifications if you will.
Post by: Dyndrilliac on April 17, 2006, 11:19 AM
I've been perusing the PHP documentation over at www.php.net (http://www.php.net) and have run into some some problems with certain functions being rather ambiguous in their exact use.

The most prominent example is fwrite(). I can't figure out if fwrite() overwrites the entire file with the data you give it, or if it simply appends. If fwrite() overwrites the files contents, how would I write multiple lines to a single file? Does the standard newline escape sequence work ('\n')? If the function simply appends, how would I clear the file out?

I realize the first reply I will get will most likely be, "Why don't you test it out, and see for yourself?". I am not at home, and killing some time writing some pseudo code and do not at the moment have the time to be experimenting. I would rather know sooner than later, so that I can get more work done than I would otherwise be able to do.

I appreciate any and all on-topic replies.
Title: Re: Some clarifications if you will.
Post by: TehUser on April 17, 2006, 11:43 AM
Hint: There's a reason they refer to fopen() so many times.
Title: Re: Some clarifications if you will.
Post by: Dyndrilliac on April 17, 2006, 02:08 PM
Ah, I see. So depending on which action I want to take, setting the file pointer at either the beginning or the end of the file will take care of that - thank you.