Hello, I am pretty new to C++, and I have a question:
I am, and have been using Dev-C++
I used this code, to delete a text file on my desktop. The first time around, it worked perfectly. Given the file example name of "dafile".
#include <stdlib.h> // needed to use system() function
int main() {
system("del dafile.txt");
return 0;
}
I compiled the file, and ran it, it worked. However, later on, I used the same code, ran it in the same conditions and nothing happened at all.
This system command worked fine the first time around, I have no idea what I have done wrong.
I have tried running this on other computers, in the same conditions, and nothing worked. Has it anything to do with the complied data? There was no errors when I checked it the second time...
Thank you.
1 1154
Hello, I am pretty new to C++, and I have a question:
I am, and have been using Dev-C++
I used this code, to delete a text file on my desktop. The first time around, it worked perfectly. Given the file example name of "dafile".
#include <stdlib.h> // needed to use system() function
int main() {
system("del dafile.txt");
return 0;
}
I compiled the file, and ran it, it worked. However, later on, I used the same code, ran it in the same conditions and nothing happened at all.
This system command worked fine the first time around, I have no idea what I have done wrong.
I have tried running this on other computers, in the same conditions, and nothing worked. Has it anything to do with the complied data? There was no errors when I checked it the second time...
Thank you.
The del command refers to the file in the current directory .
I hope that you are referring to the file in the desktop?
If you need you can use remove command also from the C code to remove the file
Raghuram
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Thaynann |
last post by:
is there a way to delete a block of text
i have started by looking for the speicific line of text that starts the
block by looking for teh index of it...but i cannot figure out out to remove...
|
by: Bob Darlington |
last post by:
I have a repair and backup database routine which runs when a user closes
down my application.
It works fine in my development machine, but breaks on a client's at the
following line:
If...
|
by: melanieab |
last post by:
Hi,
I'm deleting nodes in my xml file, and it does seem to work, but then when I
later reload the file and make an xmlNodeList, the nodelist count still
includes the deleted nodes yet the file...
|
by: GMK |
last post by:
Dear all
in my asp.net application i have a text file that is installed with my
application on the server.
this text file is filled with data through a web interface in my
application.
i need to...
|
by: Martin Bischoff |
last post by:
Hi,
I'm creating temporary directories in my web app (e.g. ~/data/temp/temp123)
to allow users to upload files. When I later delete these directories (from
the code behind), the application...
|
by: George |
last post by:
VB.net 2003 standard, XP windows home edition.
Installed first application OK today.
When I removed the application via Control Panel, there were no
problems and the app folders were deleted.
...
|
by: shandra |
last post by:
I have a file I need to delete or truncate. I tried using the KILL
command in VB6. I tried using the file.delete command in VB.net. I
tried manually deleting, renaming, and copying over the...
|
by: Harry Barker |
last post by:
Hi Group
I Have to complete a small project and i need you guys help in doing
it. I have to create a Tool that will automatically delete a file from
the Harddrive and also deleting a SubKey from...
|
by: programming |
last post by:
how do i delete from a text file 1 of the following lines:
jon|scott
adam|smith <--delete
paul|clark
say i would like to delete the middle line of this txt, in member.txt
what php code or...
|
by: blackice |
last post by:
Hello All,
i have a Perl Script that deleting Zones from named.conf file and here is the script
#!/usr/bin/perl -w
use strict;
print "please enter the domain name: ";
chomp (my...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |