Writting at end of the file:

open("name", WRITE | APPEND)

Reading or writting at start:

open("name", READ | WRITE)