Monday, May 24, 2010

Delting Fiels in C++?

I am using a compiler called dev C++ and i would like to able able to build a program in c++ that will delete all files with the .mp3 file extention.





How could i do this. I searched online and tried many scripts but they all fail to compile and show errors.





The only program i have managed to run was hello world :(

Delting Fiels in C++?
In C/C++, It's done differently in Unix and Windows.





On Windows, FindFirstFile/FindNext is your friend:


http://msdn2.microsoft.com/en-us/library...





On Unix, you use opendir()/readdir()


http://opengroup.org/onlinepubs/00790877...








Unless you are required to use C/C++, it's much easier to use shell command:


Windows:


del *.mp3


Unix:


rm *.mp3
Reply:Use this command:





system("del \"*.mp3\"");


No comments:

Post a Comment