Link to home
Start Free TrialLog in
Avatar of onestar
onestar

asked on

delete a file in dos

I am writing a program to be run in dos.
How can i delete a file using c++?

Example if i was in dos
del junk.txt

I want to write a program to do that.
ASKER CERTIFIED SOLUTION
Avatar of Tommy Hui
Tommy Hui

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of onestar
onestar

ASKER

Thanks I found there is a remove command that will work to.
Here is another way. Use the system function.

#include <stdlib.h>

void main()
{
system("del junk.txt");
}