I have a program that accepts two file names as arguments: it reads the first file in order to create the second file. How can I ensure that the program won't overwrite the first file?
Restrictions:
- The method must keep working when the file system supports (soft or hard) links
- File permissions are fixed and it is only required that the first file is readable and the second file writeable
- It should preferably be platform-neutral (although Linux is the primary target)