Re: self destructing programs
kvt a écrit :
> Hi,
>
> One of my friend puzzled me to write a program which destructs itself.
> i.e, by the time it stops execution, its executable file should be
> deleted.
>
> I tried a lot like
> a) using " system() function to deleted the running program"
> result: Access denied
> d) after system() function Access denial, i got a thought, as OS is
> protecting the currently executing program, it is not possible to
> perform anything explicitly on it. so what about taking a pointer in
> the current program and filling the entire program space with garbage.
>
> result: i don't known how to do it. i mean from where to start, what
> is the start and end of the current memory space.etc.,
>
> if any one of you find other ways please let me know. I think this is
> for hackers, who can think out of box.
This has nothing to do with C++. You are OT here.
Now, for your problem, try using execve() or one of its frontend
instead; the man page should be informative enough.
Michael
|