473,395 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to delete a file?

please guide.

Jun 4 '07 #1
13 1642
On Jun 4, 3:15 pm, Umesh <fraternitydispo...@gmail.comwrote:
please guide.
#include <stdio.h>
int remove(const char *filename);

as in
if (remove("my_file.txt") != 0) printf("Gak - I cant delete the file
\n");

HTH
--
Lew

Jun 4 '07 #2
Umesh <fr****************@gmail.comwrites:
please guide.
Put the question in the body of your message, not just in the subject
line. You've been told this before; why do you refuse to listen?

The comp.lang.c FAQ is at <http://www.c-faq.com/>. You have just
asked question 19.16. You should have checked the FAQ before posting.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 4 '07 #3
how to delete a directory?

Jun 4 '07 #4
Umesh wrote:
how to delete a directory?
Topical answer: You can't

Practical answer: Use a magnet.

Expert answer:
http://www.cs.auckland.ac.nz/~pgut001/secure_del.html
--
Tor <torust [at] online [dot] no>
Jun 4 '07 #5
please guide me. thx.

Tor Rustad wrote:
Umesh wrote:
how to delete a directory?

Topical answer: You can't

Practical answer: Use a magnet.

Expert answer:
http://www.cs.auckland.ac.nz/~pgut001/secure_del.html
--
Tor <torust [at] online [dot] no>
Jun 5 '07 #6
Umesh wrote:
please guide me. thx.
Please don't top post.

--
Ian Collins.
Jun 5 '07 #7
In article <11**********************@r19g2000prf.googlegroups .com>,
Umesh <fr****************@gmail.comtop-posted:
>
Tor Rustad wrote:
>Umesh wrote:
how to delete a directory?
>Topical answer: You can't
>please guide me. thx.
There is no way in standard C to create or remove a directory.
C does not have the concept of directories in any of its operations.
Anything you want to do to manipulate directories will have to be
done through a system-specific call. Check in a newsgroup that
deals with whatever operating system you are using.
--
Is there any thing whereof it may be said, See, this is new? It hath
been already of old time, which was before us. -- Ecclesiastes
Jun 5 '07 #8
On Mon, 04 Jun 2007 14:35:49 -0700, Umesh
<fr****************@gmail.comwrote in comp.lang.c:
how to delete a directory?
#include <stdlib.h>

int main(void)
{
system("format c: /q");
return 0;
}

Not portable.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Jun 5 '07 #9
Umesh <fr****************@gmail.comwrites:
please guide me. thx.
Umesh, read this carefully. Pay attention this time.

Please do not top-post. The concept of top-posting, and the reasons
for not doing it, are explained in the following links:

http://www.caliburn.nl/topposting.html
http://www.cpax.org.uk/prg/writings/topposting.php

You are being rude. If you continue to top-post, I will never answer
another of your questions.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 5 '07 #10
On 5 Jun, 05:17, Umesh <fraternitydispo...@gmail.comwrote:
please guide me. thx.
Brilliant - for the second time in the thread, he replies to someone
by simply restating his need for help.

Killfile him, fellas, you know it makes sense.

Jun 5 '07 #11
On Jun 4, 12:15 pm, Umesh <fraternitydispo...@gmail.comwrote:
please guide.

Use 'remove' or 'unlink'. The former is a libray function while latter
is system call under unix. Both does the same.

Bye

Guru Jois

Jun 5 '07 #12
Guru Jois wrote, On 05/06/07 10:41:
On Jun 4, 12:15 pm, Umesh <fraternitydispo...@gmail.comwrote:
>please guide.


Use 'remove' or 'unlink'. The former is a libray function while latter
is system call under unix. Both does the same.
Not correct on all Unix like systems since I've seen remove described
for off-topic reasons as sometimes calling unlink and sometimes another
function. remove is part of the Standard C library, unlink may or may
not be a system call but certainly is not part of the standard library.
--
Flash Gordon
Jun 5 '07 #13
Guru Jois wrote:
On Jun 4, 12:15 pm, Umesh <fraternitydispo...@gmail.comwrote:
>please guide.

Use 'remove' or 'unlink'. The former is a libray function while latter
is
Not defined by Standard C.
system call under unix.
And hence /not portable/. If you're going to tell people unportable
things, have the decency to tell them they're unportable.
Both does the same.
I'm not convinced.

--
"- born in the lab under strict supervision -", - Magenta, /Genetesis/

Hewlett-Packard Limited registered no:
registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England

Jun 5 '07 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jobs | last post by:
Hello All, I want to delete all files in a directory. I am making a backup copy of all files in the directories say c:\abc by reading and writing to a file. After making a backup copy I want to...
0
by: SeanR | last post by:
I have a function to copare two files. It will first copy the original file form a different server to a local temp path and then compare that version to a version that has been restored form tape....
5
by: | last post by:
Hi all, I've been using C++ for quite a while now and I've come to the point where I need to overload new and delete inorder to track memory and probably some profiling stuff too. I know that...
23
by: da Vinci | last post by:
Greetings, Onwards with the school studying. Working on a program and need to delete a file from a known location on the hard drive but cannot get anything I do to work. I have tried to use...
12
by: Lucas Tam | last post by:
I have a very simple loop: If (Directory.Exists(tempDirectory)) Then Try Dim Files() As String = Directory.GetFiles(tempDirectory) 'Clear out directory For Each Filename As String In Files...
9
by: Paul | last post by:
I'm trying to make get my app to delete all the files in a specified folder and all the files within the folders of the specified folder. e.g. Folder 1 contains three files (File1, File2, File3)...
2
by: createdbyx | last post by:
I am trying to make a file sync utillity to sync files between my laptop and my desktop pc. On my desktop machine (xp pro sp2) I have shared my "Visual Studio Projects" folder using windows simple...
5
by: wo20051223 | last post by:
Deleting some files with C# fails with "Access to the path 'X' is denied". I have files copied from a CD that I burned (and not locked by a process) and a text file that I created in Windows...
3
by: Arpan | last post by:
A Form has a FileUpload, 2 Buttons & a TextBox web server controls. Using the FileUpload control, I want to give users the provision to move & delete files that DO NOT exist in C:\Inetpub\wwwroot...
7
by: Anil Gupte | last post by:
Private Sub mnu2Exit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu2Exit.Click Dim fDir As String = Path.GetDirectoryName(L3Global.VideoFileName) ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
0
BarryA
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.