Archive 17/01/2023.

How to clear the content in the existing file

chenjie199234

just like the title.
now i have a file filled with old data and i want to use new data to cover it.
the problem is that,how to clear the file.
i can delete the file through enhine’s subsystem,but i cant create a new one.there is no such api.
there is also no function to clear the file’s content
there is also no more mode flags when we open the file,only read write.
so how to clear one file’s content

Modanung

Simply create a new file - instead of opening one - and save it over the other one.

Could you share some code if this doesn’t clarify things?

SirNate0

Open the file as write only and I’m pretty sure it will create it if it doesn’t exist and overwrite the contents if it does.