How to elegantly open or create new file for reading and writing but not discard existing contents?
5 views (last 30 days)
If the file exists, open it for reading and writing, but don't discard existing content; else, create it.
Isn't it a very common use case? Why does fopen not seemingly support this?
Note that I don't want to append. I want to read and overwrite some part of the existing content while keep other parts.
More Answers (1)
KSSV on 4 Aug 2021