On Wed, 30 Jun 2004 19:05:55 +0200, Andreas Baumgart
<> wrote in comp.lang.c++:
> On Wed, 30 Jun 2004 11:32:42 -0400
> "Sonoman" <> wrote:
>
> > I would like to find out how to write a small program that deletes
> > files. I
> > want to be able to delete all files from a known directory (i.e.
> > cookies,
> > temp files, etc.) regardless of type and name, "or" may be by
> > extension.
>
> The way you delete files from a filesystem normally depends on the
> syscalls your os provides. So there is no clear way to do this.
Apparently you are unaware of the standard C++ library function
std::remove() prototyped in <cstdlib>, which may also be invoked as
::remove() by including <stdlib.h>.
These have been part of the ISO C standard for 15 years now, and part
of ISO C++ for nearly 6 years. They work on all conforming hosted
implementations, and that includes Linux and Windows.
> On Linux systems there is a syscall "unlink" which can do that. There
> also exists an accordant function unlink() in the libc. I am quite sure
> there exists a similar library for Windows, too.
>
> Greets,
> Andreas
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html