I am trying to open a file, flock it, read it and then write to it. I am trying to do both the read and write under one flock so that there is no possiblility of someone opening the file between the read and write.