how to create file if it not exist at give path in qt ?
Solved
General and Desktop
-
@JonB said in how to create file if it not exist at give path in qt ?:
If you want to overwrite after reading, then do not use QIODevice::ReadWrite
You can, simply do resize(0) before writing
wrote on 17 Nov 2022, 13:10 last edited by@mpergand
Indeed, which probably callstruncate()
. It does not say whether you must thenseek(0)
as well, many platforms require seek-when-change-from-read-to-write. It's yet another way. Personally I probably would not open forReadWrite
and do that. The OP now has a choice of approaches.
21/21