• Welcome to Valhalla Legends Archive.
 

Some clarifications if you will.

Started by Dyndrilliac, April 17, 2006, 11:19 AM

Previous topic - Next topic

Dyndrilliac

I've been perusing the PHP documentation over at 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.
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

TehUser

Hint: There's a reason they refer to fopen() so many times.

Dyndrilliac

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.
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.