Re: remove or _unlink using wildcard?

Y

yangyong

news.tele.dk said:
Hi There,

I have been trying to delete several files by using wildcard using either
remove or _unlink, but non of them seems to work.

char temp_files[MAX_PATH];
strcpy(temp_files, "c:\\tmp*.*");
_unlink(temp_files); // doesn't work
remove(temp_files); // doesn't work either

Can someone please tell me how I delete several files using wildcard?

Thanks in regards,
Jess

---
Jess Nielsen, HND/C
Systems Developer

"I don't want to be a pie, I don't like gravy!"


Windows: you can FindFirstFile, FindNextFile loop.
 
T

Thomas Matthews

yangyong said:
Hi There,

I have been trying to delete several files by using wildcard using either
remove or _unlink, but non of them seems to work.

char temp_files[MAX_PATH];
strcpy(temp_files, "c:\\tmp*.*");
_unlink(temp_files); // doesn't work
remove(temp_files); // doesn't work either

Can someone please tell me how I delete several files using wildcard?

Thanks in regards,
Jess



Windows: you can FindFirstFile, FindNextFile loop.

But what if I'm not using windows?

O.P.:
The remove() function is for removing a single file.
You will need to use operating system functions for
deleting more than one file at a time.

You could use the system() function and specify
the OS command for deleting many files.

For more information about deleting many files,
please consult a newsgroup about your platform.
See the FAQs and Welcome.txt listed below.
--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 
A

Alexander Terekhov

Thomas Matthews wrote:
[...]
But what if I'm not using windows?

Felony. $250,000 fine and five years in prison (ten
years on a second offense).

regards,
alexander.
 

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
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top