Solved

delete a file in dos

Posted on 1998-06-11
3
190 Views
Last Modified: 2010-04-01
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
Comment
Question by:onestar
3 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
Comment Utility
Use the C API unlink().
0
 
LVL 1

Author Comment

by:onestar
Comment Utility
Thanks I found there is a remove command that will work to.
0
 

Expert Comment

by:onka34
Comment Utility
Here is another way. Use the system function.

#include <stdlib.h>

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

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now