how to delete a file?

L

Lew Pitcher

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
 
K

Keith Thompson

Umesh said:
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.
 
W

Walter Roberson

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.
 
M

mark_bluemel

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.
 
F

Flash Gordon

Guru Jois wrote, On 05/06/07 10:41:
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.
 
C

Chris Dollin

Guru said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top