you should try rewind() in order to set file pointer to beginning
It is also possible using r+ as the mode
Gerrit Lansing wrote:
how do i open a file using fopen(), whose file pointer is at the beginning of the file and if the file does not exist i want to create it. But, i know you can use w+ or w in the mode options, but i don't want to delete existing data from the file, there is no documentation in the PHP manual for anything like that, i've tried fseek($fp, 0), etc... but i just want the file pointer at the beginning and if it doesn't exist i wish to create it. thanks, -g