By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,134 Members | 1,742 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,134 IT Pros & Developers. It's quick & easy.

how to delete a file?

P: n/a
please guide.

Jun 4 '07 #1
Share this Question
Share on Google+
13 Replies


P: n/a
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

P: n/a
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

P: n/a
how to delete a directory?

Jun 4 '07 #4

P: n/a
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

P: n/a
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

P: n/a
Umesh wrote:
please guide me. thx.
Please don't top post.

--
Ian Collins.
Jun 5 '07 #7

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.