Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

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.
0
onestar
Asked:
onestar
1 Solution
 
Tommy HuiEngineerCommented:
Use the C API unlink().
0
 
onestarAuthor Commented:
Thanks I found there is a remove command that will work to.
0
 
onka34Commented:
Here is another way. Use the system function.

#include <stdlib.h>

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

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now