Securely deleting files usually requires direct access to the filesystem and underlying storage driver because write/erase behavior is different for the underlying storage medium (e.g. writing to a file on a HD is significantly different from writing to a Flash-based medium).
On a HD it might be sufficient to open the file, write to it random data and then delete the file.
Especially for Flash-based media you don't have any guarantees, when a block is actually erased unless you can directly access the driver and force it to erase the block that previously contained the file.
If you don't have driver access, you can
try to force an erase on a flash medium by these steps:
delete the file
The blocks used by the file are marked as no longer in use,
but their contents is still on the medium. Even writing to the file would not help, as the modified blocks are not replaced in-place, but put elsewhere on the medium.
Create a new file and write to it until the whole medium is filled
As the medium fills, the unused blocks are collected and erased to make blocks available for the growing file. When the medium is full, the blocks containing the deleted file
should be erased and overwritten. The actual behavior is dependent on the driver implementation and the flash controller in use, so these steps are likely to force the block to be overwritten, but there are no guarantees.
The other downside of this approach is the time required to fill the medium.