Difference between r+ and w+ in fopen()

Both r+ and w+ can read and write to a file. However, r+ doesn’t delete the content of the file and doesn’t create a new file if such file doesn’t exist, whereas w+ deletes the content of the file and creates it if it doesn’t exist.

Leave a Comment