I am writing a c program where I need to switch file mode from write to append but also need to maintain the file lock that I applied to the file by opening it in write mode