Solved

delete a file in dos

Posted on 1998-06-11
3
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

630 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