Works for either input or output purpose.
I used ifstream since learner guy wanted the file to be cleared at startup.
This can pretend writing something in the file, before you actually use it.
Of course it's pointless truncating a file when you actually want to see whats inside.
But in case he only wants to empty it(without seeing in the file or writing in it), then it doesn't really matter which one you use.
**how to solve invalid keystore error in android studio here is error report----------------------->
here is error report--------> error:Error:java.lang.RuntimeException: com.android.ide.common.signing.KeytoolException: Failed to read key palash from store "D:\MyApplication3.idea\workspace.xml": Invalid keystore format ...