Solved

delete a file in dos

Posted on 1998-06-11
3
193 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
ID: 1165654
Use the C API unlink().
0
 
LVL 1

Author Comment

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

Expert Comment

by:onka34
ID: 1165656
Here is another way. Use the system function.

#include <stdlib.h>

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

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

821 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