Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

remove or _unlink using wildcard?

4 views
Skip to first unread message

news.tele.dk

unread,
Jun 27, 2003, 5:20:54 AM6/27/03
to
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!"

yangyong

unread,
Jun 27, 2003, 5:47:06 AM6/27/03
to

"news.tele.dk" <j...@online.stofanet.dk> 写入邮件
news:3efc0c16$0$32469$edfa...@dread16.news.tele.dk...


Windows: you can FindFirstFile, FindNextFile loop.


---
Posted via news://freenews.netfront.net
Complaints to ne...@netfront.net

Thomas Matthews

unread,
Jun 27, 2003, 10:16:17 AM6/27/03
to
yangyong wrote:
> "news.tele.dk" <j...@online.stofanet.dk> 写入邮件
> news:3efc0c16$0$32469$edfa...@dread16.news.tele.dk...
>
>>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
>
>
>
> 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

Alexander Terekhov

unread,
Jun 27, 2003, 10:42:14 AM6/27/03
to

Thomas Matthews wrote:
[...]

> > Windows: you can FindFirstFile, FindNextFile loop.
> >
>
> 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.

Artie Gold

unread,
Jun 27, 2003, 12:31:44 PM6/27/03
to
news.tele.dk wrote:
> 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?
>
Standard C++ knows neither of wildcards nor _unlink.
[It's a platform-specific extension. Posting in a forum dedicated to the
particular platform upon which you are working will most likely get you
the help you need.]

HTH,
--ag

--
Artie Gold -- Austin, Texas

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

0 new messages