I an trying to change a script that writes to a txt file from the 'a' attribute to 'r+'. It is tending to overwrite part of the existing file when I do that. I want to append the new stuff to top of the file. Pretty darn close to char for char is what the overwrite appears to be. Have I misunderstood how this works? If I have, is there someway to make the last appear first when the file is read for viewing?
Yeah, cause 'r+' writes over the whole file. Starting from the begining of that file. 'a+' starts at the end of what was last wrote in the file and continues from there. http://us.php.net/manual/en/function.fopen.php Look at the table and tell me which one is best for you to use?
So overwriting is what happens with 'r+'. I really want the new information at the top of the page, not at the bottom. Anyone have a suggestion?
Read in the information into a variable. Then add the information to the beginning of the variable and then write it back out. (possibly use arrays to store the information). Redundant way of doing it, but that is the only way around it that I can think of. I would make a function that does it so I can just supply the variables instead of having to write it out each time it is used. __________________ Give for good answers.