Home > OS >  C how to implement a delete files
C how to implement a delete files

Time:09-19

Hi:
I've been doing a project on which to the operation of the sd card, I need to implement file delete and delete,
File deletion is very simple, it is ok to call the remove function, delete files, I don't know what to do,
Linux shred or wipe command can be realized, but I can't use the system (), what do you suggest?

CodePudding user response:

To realize the permanent,

I have an idea is that in the sd card to set up a permanent partition, don't delete the partition format, is this a permanent,
To permanently delete files, I create a partition, put the file in this partition, then its format, this will permanently delete,
This method is feasible, or what is the good way, I feel I like a little stupid,

CodePudding user response:

Delete, you must first according to the meta information of file (inode), find the file data block position, then put these position all rewrite to 0

CodePudding user response:

If SD is FAT format, file deletion is the file directory entry with 0 xd5 catalogue (this) should be marked, the actual file data, so want to delete, you have to put the file where the data is all sectors of the empty, you can do as this way of thinking,
Files stored permanently, however, are bad to did, if SD don't open the write protect, so the theory can be forced to format the SD space, and write protect can't alone to an area, a kind of way is to put the SD card is divided into 2 two partitions, one partition invisible hide, another partition normal use, but with partition software, still can find and remove,
  • Related