Objective
Self-deletion: As the name implies, this program function is very simple, is to implement the program's self-deletion function.
is not feeling very confused, a program runs on its own, how to shut itself down, and then delete it? By the time you finish your process, you will end up and no longer execute any code. When the program executes, the file is open, and it cannot be deleted. is not to think, ah, can not think of the right.
If you can't figure it out, look for the mirror.
Implementation principle
Program self-deletion implementation of the idea is: The program creates a batch file, and create a process execution, and then the program ends the process, the function of the batch is to delay 5 seconds after the deletion of the specified program and then self-delete. In this way, the program self-deletion function is implemented.
Is it very simple, I'll bring you to realize it
Test case
1. Test Case procedure
It's a Hello world.
2. Batch self-delete files
Code snippet:
All right, that's what this whole thing looks like.
I have a public number, often share some of the C language/c++ technology related dry goods; If you like my share, you can use the search "C language learning Tribe" to focus on
Welcome to join thousands of people to exchange questions and answers skirt: 627+012+464
The C language Restricted area program itself deletes itself? It's time to show the real technology of the self-removal