Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delete files in a directory in c++

Posted on 2004-10-24
4
Medium Priority
?
605 Views
Last Modified: 2013-11-17
I need to delete all files with extension ".txt" form a specific folder in C++.
How do I do this?

I do not wnat to use system("del *.txt");

Thanks
Regards
Jas
0
Comment
Question by:jas123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 16

Accepted Solution

by:
George Tokas earned 1000 total points
ID: 12398192
Assuming that you are using BCB...
Check out online help for FindFirst(..) .
It is under file management utilities.
With FindFirst you can locate the first occurence of a file matching the criteria you want (*.txt) in your case...
From the structure TSerchRec you can get the ansistring contains the filename.
After you obtain with those the filename in an AnsiString you can use:
DeleteFile(AnsiString Filename) to delete.


gtokas.
0
 
LVL 9

Expert Comment

by:Cayce
ID: 12477332
Is this question abandoned? Wasn't gotkas comment sufficient? do you need an example? is it kerry or is it bush?

Please let us know jas.

Regards
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question