You can't. You're entirely beholden to the implementation details of the storage stack below your application, which is opaque to you.
Here are some examples of scenarios in which the original data would remain latent:
- The user could have a cloud backup solution that keeps copies of their files online.
- Volume shadow copies could be configured, meaning that the file's historical contents are retained.
- If the file is an image, its thumbnail may be stored in a thumbnail database maintained by the OS shell.
- Cached copies of the original file data may be stored in memory by the operating system.
- The file you're encrypting might not be on local storage (e.g. it might be on an SMB share or iSCSI volume), meaning you have no control over the backups or redundancy that might be present.
- The filesystem implementation is likely to utilise soft-deletion, in which a delete operation simply removes the file record and marks the blocks associated with the file data as free, ready for re-use, rather than wastefully overwriting the blocks.
- The implementation of the filesystem may include journaling or other features that temporarily store file data on the disk outside the normal file structure.
- SSDs and other flash storage devices may utilise wear-levelling and slack space, in which the physical flash cells are dynamically mapped to logical blocks that are presented to the system, and the physical amount of flash storage may exceed the amount of storage that is exposed to the user. This is done in order to increase the lifespan of the drive, because flash cells can only survive a certain number of write cycles. When you perform a write operation to a block, the SSD can choose to write that data to any physical flash cell that is marked as free in its internal map, rather than overwriting the cell that previously contained the data.
- Storage redundancy architectures like RAID may retain copies of data in numerous ways.
This problem is non-trivial, and cannot be solved with a software application. Entire standards, such as NIST SP 800-88r1, have been written to govern safe methods of data destruction. Secure erasure of data requires careful security considerations to be made for the entire software and hardware stack, and must be supported by user behaviour (including organisational policy).