fopen (),
r+
w+
It's all a read-write mode, isn't it different? Then why did you make 2 out of it?
It's best to write an example to see
Reply to discussion (solution)
R read-only opens, pointing the file pointer to the file header.
The "r+" read-write mode opens, pointing the file pointer to the file header.
The "W" Write method opens, pointing the file pointer to the file header and truncating the file size to zero. If the file does not exist, try to create it.
The "w+" read-write mode opens, pointing the file pointer to the file header and truncating the file size to zero. If the file does not exist, try to create it.
The "A" write opens, pointing the file pointer to the end of the file. If the file does not exist, try to create it.
A + read-write mode opens, pointing the file pointer to the end of the file. If the file does not exist, try to create it.
Like upstairs, r+ will point the file pointer to the file header. When you write to it, it's your new content + original content
w+ also points the file pointer to the file header, but he will first empty the contents of the file before adding new content The result file contains only the newly added content
Study of the study